Forum: Ruby win32::process and nested fork()s

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
8eaa128e738406b877ac89f6781148e2?d=identicon&s=25 Martin Carpenter (Guest)
on 2007-03-10 11:40
(Received via mailing list)
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 topic is locked and can not be replied to.