Blocking IO on windows in IRB

C

Charles Lowe

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

ara.t.howard

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-1.0.0/README

gem install systemu

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

a @ http://drawohara.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top