Win32::process and nested fork()s

I can’t seem to make nested fork()s (granchildren processes) work with
win32::process module. Here’s my simple test script:

1 require “win32/process”
3 Process.fork do
4 $stdout.“child #{}” ; $stdout.flush
5 2.times{
6 Process.fork do
7 $stdout.puts “sub-child #{}” ; $stdout.flush
8 end
9 }
10 end

Output from my test script below gives:

child 4384

Linux (using the “native” Process.fork, ie. skipping the require on line
child 5126
sub-child 5127
sub-child 5128

If I comment out lines 6 and 8, I get an appropriate amount of output
windows (although, of course, always with the same PID). I’m not sure
this is a problem with win32::process, with the IO stream… or with
something else entirely?

On Windows, I’m running:

  • WinXP SP2
  • ruby 1.8.5 (2006-12-25 patchlevel 12) [i386-mswin32]
  • win32-process (0.5.2, 0.5.1)

Thanks for any help!


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs