# IO.write problem on "raw" Windows

**URL:** <https://www.ruby-forum.com/t/io-write-problem-on-raw-windows/108025>\
**Category:** Ruby\
**Created:** [June 28, 2007, 2:46pm UTC](https://www.ruby-forum.com/t/io-write-problem-on-raw-windows/108025 "2007-06-28T14:46:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [June 28, 2007, 2:46pm UTC](https://www.ruby-forum.com/t/io-write-problem-on-raw-windows/108025/1 "2007-06-28T14:46:26Z")

</div>

Hi,

I have a problem with the following code:

prg = “c:\path\to\some\program” # for cmd

# prg = “/cygdrive/c/path/to/some/program” # for cygwin

IO.popen(prg, “r+b”) do |pipe|  
File.open ARGV[0], ‘rb’ do |fin|  
pipe.write fin.read  
end  
end

On Windows, when running “normal” ruby from a command prompt (Windows’  
cmd.exe), it blocks on write. I can interrupt it using Ctrl+C, but it  
never goes through. Doing all sorts of “debug” testing, I found out  
that it always blocks on the same character if the input data is the  
same. Different input data (i.e. different input files, whose  
filenames are given on a command line) gives different results. I am  
using ruby 1.8.6.

What is even more interesting is that on Cygwin this works. I have  
ruby 1.8.5 there. Also, it is working on other machines. The “other”  
program itself is working fine - it’s a simple echo-clone. Do you have  
any idea what might be causing this? I thought of a lot of good  
reasons, but failed to find one that really is the one. At least, do  
you have any suggestions of what I might try?
