Hi Park, I tried your latest patch and ran the sample code: readPipe, writePipe = IO.pipe t = Thread.new{ sleep 5 while true sleep 0.1 puts "got #{readPipe.readline.length} bytes" end } i = 1 while true i += 1 sleep 1 puts "hello from main" if i > 3 writePipe.puts "a"*2048 end end t.join At the console I typed the word "world", let it run for a bit, then hit Ctrl-C. It mostly seems to work. Here was the difference between Ruby with your patch and JRuby 1.1.1. # Ruby 1.8.6-114 with patch C:\Documents and Settings\djberge\workspace>ruby pipe_test.rb hello from main hello from main hello from main got 2049 bytes hello from main got 2049 bytes hello from main got 2049 bytes hello from main got 2049 bytes hello from main got 2049 bytes hello from main got 2049 bytes hello from main got 2049 bytes hello from main got 2049 bytes pipe_test.rb:14:in `sleep'': Interrupt from pipe_test.rb:14 C:\Documents and Settings\djberge\workspace>world ''world'' is not recognized as an internal or external command, operable program or batch file. # Jruby 1.1.1 C:\Documents and Settings\djberge\workspace>c:\jruby\bin\jruby pipe_test.rb hello from main hello from main hello from main hello from main hello from main got 2049 bytes got 2049 bytes got 2049 bytes hello from main got 2049 bytes hello from main got 2049 bytes Terminate batch job (Y/N)? y Is the difference anything we should worry about? Regards, Dan
Hi, ----- Original Message ----- From: "Daniel Berger" <djberg96 at gmail.com> To: "Development and ideas for win32utils projects" <win32utils-devel at rubyforge.org> Sent: Monday, May 12, 2008 5:39 AM Subject: [Win32utils-devel] Latest rb_win32_select patch> Hi Park, > > I tried your latest patch and ran the sample code: > > readPipe, writePipe = IO.pipe > > t = Thread.new{ > sleep 5 > while true > sleep 0.1 > puts "got #{readPipe.readline.length} bytes" > end > } > > i = 1 > while true > i += 1 > sleep 1 > puts "hello from main" > if i > 3 > writePipe.puts "a"*2048 > end > end > t.join > > At the console I typed the word "world", let it run for a bit, then hit > Ctrl-C. It mostly seems to work. Here was the difference between Ruby > with your patch and JRuby 1.1.1. > > # Ruby 1.8.6-114 with patch > C:\Documents and Settings\djberge\workspace>ruby pipe_test.rb > hello from main > hello from main > hello from main > got 2049 bytes > hello from main > got 2049 bytes > hello from main > got 2049 bytes > hello from main > got 2049 bytes > hello from main > got 2049 bytes > hello from main > got 2049 bytes > hello from main > got 2049 bytes > hello from main > got 2049 bytes > pipe_test.rb:14:in `sleep'': Interrupt > from pipe_test.rb:14 > > C:\Documents and Settings\djberge\workspace>world > ''world'' is not recognized as an internal or external command, > operable program or batch file. > > # Jruby 1.1.1 > > C:\Documents and Settings\djberge\workspace>c:\jruby\bin\jruby pipe_test.rb > hello from main > hello from main > hello from main > hello from main > hello from main > got 2049 bytes > got 2049 bytes > got 2049 bytes > hello from main > got 2049 bytes > hello from main > got 2049 bytes > Terminate batch job (Y/N)? y > > Is the difference anything we should worry about? >The patch is very experimental and it comes with ABSOLUTELY NO WARRANTY :) The still remaining problem is the incorrect or unwanted console input handling. I hope someone would fix the problem. Regards, Park Heesob
Park Heesob wrote:> Hi, > ----- Original Message ----- > From: "Daniel Berger" <djberg96 at gmail.com> > To: "Development and ideas for win32utils projects" <win32utils-devel at rubyforge.org> > Sent: Monday, May 12, 2008 5:39 AM > Subject: [Win32utils-devel] Latest rb_win32_select patch > > >> Hi Park, >> >> I tried your latest patch and ran the sample code: >> >> readPipe, writePipe = IO.pipe >> >> t = Thread.new{ >> sleep 5 >> while true >> sleep 0.1 >> puts "got #{readPipe.readline.length} bytes" >> end >> } >> >> i = 1 >> while true >> i += 1 >> sleep 1 >> puts "hello from main" >> if i > 3 >> writePipe.puts "a"*2048 >> end >> end >> t.join >> >> At the console I typed the word "world", let it run for a bit, then hit >> Ctrl-C. It mostly seems to work. Here was the difference between Ruby >> with your patch and JRuby 1.1.1. >> >> # Ruby 1.8.6-114 with patch >> C:\Documents and Settings\djberge\workspace>ruby pipe_test.rb >> hello from main >> hello from main >> hello from main >> got 2049 bytes >> hello from main >> got 2049 bytes >> hello from main >> got 2049 bytes >> hello from main >> got 2049 bytes >> hello from main >> got 2049 bytes >> hello from main >> got 2049 bytes >> hello from main >> got 2049 bytes >> hello from main >> got 2049 bytes >> pipe_test.rb:14:in `sleep'': Interrupt >> from pipe_test.rb:14 >> >> C:\Documents and Settings\djberge\workspace>world >> ''world'' is not recognized as an internal or external command, >> operable program or batch file. >> >> # Jruby 1.1.1 >> >> C:\Documents and Settings\djberge\workspace>c:\jruby\bin\jruby pipe_test.rb >> hello from main >> hello from main >> hello from main >> hello from main >> hello from main >> got 2049 bytes >> got 2049 bytes >> got 2049 bytes >> hello from main >> got 2049 bytes >> hello from main >> got 2049 bytes >> Terminate batch job (Y/N)? y >> >> Is the difference anything we should worry about? >> > The patch is very experimental and it comes with ABSOLUTELY NO WARRANTY :) > The still remaining problem is the incorrect or unwanted console input handling. > I hope someone would fix the problem.Sorry if I sounded too critical. I''m just not sure what the proper behavior should be and I''m trying to work it out. I''ll see what I can come up with as far as a patch (assuming one is needed). I think our options are easier if we limit ourselves to Win2k or later (or even XP or later). This is still a HUGE improvement over the current MRI behavior. :) Regards, Dan
----- Original Message ----- From: "Daniel Berger" <djberg96 at gmail.com> To: "Development and ideas for win32utils projects" <win32utils-devel at rubyforge.org> Sent: Monday, May 12, 2008 12:35 PM Subject: Re: [Win32utils-devel] Latest rb_win32_select patch> Park Heesob wrote: >> Hi, >> ----- Original Message ----- >> From: "Daniel Berger" <djberg96 at gmail.com> >> To: "Development and ideas for win32utils projects" <win32utils-devel at rubyforge.org> >> Sent: Monday, May 12, 2008 5:39 AM >> Subject: [Win32utils-devel] Latest rb_win32_select patch >> >> >>> Hi Park, >>> >>> I tried your latest patch and ran the sample code: >>> >>> readPipe, writePipe = IO.pipe >>> >>> t = Thread.new{ >>> sleep 5 >>> while true >>> sleep 0.1 >>> puts "got #{readPipe.readline.length} bytes" >>> end >>> } >>> >>> i = 1 >>> while true >>> i += 1 >>> sleep 1 >>> puts "hello from main" >>> if i > 3 >>> writePipe.puts "a"*2048 >>> end >>> end >>> t.join >>> >>> At the console I typed the word "world", let it run for a bit, then hit >>> Ctrl-C. It mostly seems to work. Here was the difference between Ruby >>> with your patch and JRuby 1.1.1. >>> >>> # Ruby 1.8.6-114 with patch >>> C:\Documents and Settings\djberge\workspace>ruby pipe_test.rb >>> hello from main<snip>>>> got 2049 bytes >>> pipe_test.rb:14:in `sleep'': Interrupt >>> from pipe_test.rb:14 >>> >>> C:\Documents and Settings\djberge\workspace>world >>> ''world'' is not recognized as an internal or external command, >>> operable program or batch file. >>> >>> # Jruby 1.1.1 >>> >>> C:\Documents and Settings\djberge\workspace>c:\jruby\bin\jruby pipe_test.rb >>> hello from main<snip>>>> got 2049 bytes >>> Terminate batch job (Y/N)? y >>> >>> Is the difference anything we should worry about? >>> >> The patch is very experimental and it comes with ABSOLUTELY NO WARRANTY :) >> The still remaining problem is the incorrect or unwanted console input handling. >> I hope someone would fix the problem. > > Sorry if I sounded too critical. I''m just not sure what the proper > behavior should be and I''m trying to work it out. >I think Ruby''s standard platform is Linux, and a different behavior from Linux box regarded as a misbehavior. In my test with the cygwin ruby version, cygwin fails to emulate select system call in colsole input. it act just like my patch version. Emulating Linux select is my goal. But it is not easy for now. Regards, Park Heesob
> -----Original Message----- > From: win32utils-devel-bounces at rubyforge.org > [mailto:win32utils-devel-bounces at rubyforge.org] On Behalf Of > Park Heesob > Sent: Monday, May 12, 2008 2:49 AM > To: Development and ideas for win32utils projects > Subject: Re: [Win32utils-devel] Latest rb_win32_select patch > > ----- Original Message ----- > From: "Daniel Berger" <djberg96 at gmail.com> > To: "Development and ideas for win32utils projects" > <win32utils-devel at rubyforge.org> > Sent: Monday, May 12, 2008 12:35 PM > Subject: Re: [Win32utils-devel] Latest rb_win32_select patch > > > > Park Heesob wrote: > >> Hi, > >> ----- Original Message ----- > >> From: "Daniel Berger" <djberg96 at gmail.com> > >> To: "Development and ideas for win32utils projects" > <win32utils-devel at rubyforge.org> > >> Sent: Monday, May 12, 2008 5:39 AM > >> Subject: [Win32utils-devel] Latest rb_win32_select patch > >> > >> > >>> Hi Park, > >>> > >>> I tried your latest patch and ran the sample code: > >>> > >>> readPipe, writePipe = IO.pipe > >>> > >>> t = Thread.new{ > >>> sleep 5 > >>> while true > >>> sleep 0.1 > >>> puts "got #{readPipe.readline.length} bytes" > >>> end > >>> } > >>> > >>> i = 1 > >>> while true > >>> i += 1 > >>> sleep 1 > >>> puts "hello from main" > >>> if i > 3 > >>> writePipe.puts "a"*2048 > >>> end > >>> end > >>> t.join > >>> > >>> At the console I typed the word "world", let it run for a > bit, then hit > >>> Ctrl-C. It mostly seems to work. Here was the difference > between Ruby > >>> with your patch and JRuby 1.1.1. > >>> > >>> # Ruby 1.8.6-114 with patch > >>> C:\Documents and Settings\djberge\workspace>ruby pipe_test.rb > >>> hello from main > <snip> > >>> got 2049 bytes > >>> pipe_test.rb:14:in `sleep'': Interrupt > >>> from pipe_test.rb:14 > >>> > >>> C:\Documents and Settings\djberge\workspace>world > >>> ''world'' is not recognized as an internal or external command, > >>> operable program or batch file. > >>> > >>> # Jruby 1.1.1 > >>> > >>> C:\Documents and > Settings\djberge\workspace>c:\jruby\bin\jruby pipe_test.rb > >>> hello from main > <snip> > >>> got 2049 bytes > >>> Terminate batch job (Y/N)? y > >>> > >>> Is the difference anything we should worry about? > >>> > >> The patch is very experimental and it comes with > ABSOLUTELY NO WARRANTY :) > >> The still remaining problem is the incorrect or unwanted > console input handling. > >> I hope someone would fix the problem. > > > > Sorry if I sounded too critical. I''m just not sure what the proper > > behavior should be and I''m trying to work it out. > > > I think Ruby''s standard platform is Linux, and a different > behavior from Linux box regarded > as a misbehavior. In my test with the cygwin ruby version, > cygwin fails to emulate select system > call in colsole input. it act just like my patch version. > > Emulating Linux select is my goal. But it is not easy for now.Maybe this is just a platform specific issue that we shouldn''t worry about. The behavior on my OS X box was a little different than JRuby even. I did read over this article: http://www.darkcoding.net/software/non-blocking-console-io-is-not-possib le/ Perhaps we could use SetConsoleMode? I haven''t played with it yet. Regards, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.