grosser / parallel

Ruby: parallel processing made simple and fast
MIT License
4.16k stars 254 forks source link

Why dont we gracefully skip on Windows (OS's without Spawn/Parallel support?) #297

Closed NemyaNation closed 3 years ago

NemyaNation commented 3 years ago

Currently the gem will just crash the application if ran on windows.

Why don't you integrate something like the os gem => https://stackoverflow.com/questions/170956/how-can-i-find-which-operating-system-my-ruby-program-is-running-on

and

if OS.unix?
  # utilize multi-threading
else
  # puts "Detecting Windows System: has no spawn/multi-threading support with ruby......
  # continue processing of process array as a regular array (sequential)
end

This way someone developing on windows can still continue to use the application (albiet slower than on a unix system)

grosser commented 3 years ago

I can see the usecase in having something work on windows without crashing, but I also don't want to build a trap where users don't realize that it's not working an easy workaround is in_processes: OS.unix? ? 5 : 0 ... so it's obvious in the code what will happen without having to deal with warnings / hidden slowness

NemyaNation commented 3 years ago

That actually makes much more sense.

Closing - thanks :)