Forum: Ruby Blocking IO on windows in IRB

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Charles L. (Guest)
on 2007-07-16 04:29
Is there anyway around the blocking IO on windows? I'm trying to write
an ruby app that is designed to be used from irb. It uses background
threads to do some work, but they don't appear to block at input on
windows.

Eg, running:

  Thread.new { sleep 2; p 'hi' }

on windows, from irb, will never print 'hi', unless you press some keys.
Meanwhile on linux it will print just fine after 2 seconds.
ara.t.howard (Guest)
on 2007-07-16 09:43
(Received via mailing list)
On Jul 15, 2007, at 6:29 PM, Charles L. wrote:

> Is there anyway around the blocking IO on windows? I'm trying to write
> an ruby app that is designed to be used from irb. It uses background
> threads to do some work, but they don't appear to block at input on
> windows.

basically, if you have to do background io use another process.  my
systemu lib is a cross platform way of dealing with stdin/out/err etc
for background processes - you might want to check it out for ideas

  http://codeforpeople.com/lib/ruby/systemu/systemu-...

         gem install systemu

this plus code generation can skin some cats.  good luck.

a @ http://drawohara.com/
This topic is locked and can not be replied to.