win32utils-devel@rubyforge.org
2004-Feb-20 13:42 UTC
[Win32utils-devel] RE: BUG report: win32-process
> -----Original Message----- > From: Date, Shashank [Non-Employee] > [mailto:Shashank.Date@mail.sprint.com] > Sent: Friday, February 20, 2004 11:04 AM > To: Berger, Daniel > Cc: phasis@nownuri.net > Subject: BUG report: win32-process > > > gets does not work in the forked process. > > See win32 and cygwin transcripts below: > > #--------------------------------------------- > require ''win32/process'' > include Win32 > STDOUT.sync = true > > # In the child, using block form > Win32::Process.fork do > 5.times { |i| > k = 0 > puts "Child: #{i}" > puts "Hit the ENTER key now >" > gets > } > end > > # Back in the parent > 4.times{ |i| > puts "Parent: #{i}" > sleep 1 > } > > Win32::Process.wait > > puts "Continuing on..." > > __END__ > Microsoft Windows 2000 [Version 5.00.2195] > (C) Copyright 1985-2000 Microsoft Corp. > > C:\atest>ruby -v tst_win32_process.rb > ruby 1.8.1 (2003-12-25) [i386-mswin32] > Parent: 0 > Child: 0 > Hit the ENTER key now > > C:/atest/tst_win32_process.rb:11:in `gets'': No such file or > directory - child (Errno::ENOENT) > from C:/atest/tst_win32_process.rb:11 > from C:/atest/tst_win32_process.rb:7:in `times'' > from C:/atest/tst_win32_process.rb:7 > from C:/atest/tst_win32_process.rb:6:in `fork'' > from C:/atest/tst_win32_process.rb:6 > Parent: 1 > Parent: 2 > Parent: 3 > Continuing on... > > C:\atest> > > #--------------------------------------------- > > #!/usr/local/bin/ruby -v > # CYGWIN > > STDOUT.sync = true > > # In the child, using block form > Process.fork do > 5.times { |i| > k = 0 > puts "Child: #{i}" > puts "Hit the ENTER key now >" > gets > } > end > > # Back in the parent > 4.times{ |i| > puts "Parent: #{i}" > sleep 1 > } > > Process.wait > puts ''Done'' > > __END__ > > $ tst_process.rb > ruby 1.8.1 (2003-12-25) [i386-cygwin] > Parent: 0 > Child: 0 > Hit the ENTER key now > > Parent: 1 > Parent: 2 > Parent: 3 > > Child: 1 > Hit the ENTER key now > > > Child: 2 > Hit the ENTER key now > > > Child: 3 > Hit the ENTER key now > > > Child: 4 > Hit the ENTER key now > > > Done > > $Try "STDIN.gets" which worked for my on my XP box. This seems to be an issue with Ruby itself that has come up on the mailing list before. I don''t think it''s a fork issue. Dan