Windows7 x64 Ruby 1.8.7 fork gem 1.0.0 error
I'm trying to create a child process using the Fork gem (version 1.0.0).
My basic code skeleton is:
child = Fork.new do |child| ## something something something ## loop loop loop ## something something something end child.execute child.wait
That follows the sample code I believe but it always returns a very counter-intuitive error:
C:/Ruby187/lib/ruby/gems/1.8/gems/fork-1.0.0/lib/fork.rb:237:in `fork': fork() f unction is unimplemented on this machine (NotImplementedError) from C:/Ruby187/lib/ruby/gems/1.8/gems/fork-1.0.0/lib/fork.rb:237:in `ex ecute'
I do have the proper gems installed:
*** LOCAL GEMS *** addressable (2.2.8) childprocess (0.3.3) ffi (1.0.11) fork (1.0.0) libwebsocket (0.1.4) multi_json (1.3.6) mysql2 (0.3.11 x86-mingw32) net-sftp (2.0.5) net-ssh (2.5.2) net-ssh-gateway (1.1.0) rdiscount (1.6.8) rubyzip (0.9.9) selenium-webdriver (2.24.0)
I attempted to use the classes' future/call method combo but that doesn't seem to work for me either. I installed and reinstalled several times to ensure this wasn't an environmental issue.
I also tried to work with the win32-process gem but this requires an existing binary from what I can understand, to be called as a subprocess. I really don't want to resort to cygwin but that might be the only way to address it.
What has been your experience with this gem?
you can't "fork" per se in windows, but you can call out to other methods using one of ruby's system calls: http://en.wikibooks.org/wiki/Ruby_Programming/Running_Multiple_Processes or win32-process or some other gem, or the winapi directly.