[Win32utils-devel] Latest rb_win32_select patch

Park Heesob phasis at gmail.com
Mon May 12 04:49:21 EDT 2008


----- 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


More information about the win32utils-devel mailing list