# Blocking IO on windows in IRB

**URL:** <https://www.ruby-forum.com/t/blocking-io-on-windows-in-irb/109505>\
**Category:** Ruby\
**Created:** [July 16, 2007, 2:29am UTC](https://www.ruby-forum.com/t/blocking-io-on-windows-in-irb/109505 "2007-07-16T02:29:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![calande](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/edb3f5/32.png) [@calande](https://www.ruby-forum.com/u/calande)\
**Post date:** [July 16, 2007, 2:29am UTC](https://www.ruby-forum.com/t/blocking-io-on-windows-in-irb/109505/1 "2007-07-16T02:29:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![calande](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/edb3f5/32.png) [@calande](https://www.ruby-forum.com/u/calande)\
**Post date:** [July 16, 2007, 7:43am UTC](https://www.ruby-forum.com/t/blocking-io-on-windows-in-irb/109505/2 "2007-07-16T07:43:00Z")

</div>

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-1.0.0/README](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/](http://drawohara.com/)
