# RubyScript2Exe in Cygwin and gets/readline: unexpected EOFEr

**URL:** <https://www.ruby-forum.com/t/rubyscript2exe-in-cygwin-and-gets-readline-unexpected-eofer/58458>\
**Category:** Ruby\
**Created:** [April 21, 2006, 9:01pm UTC](https://www.ruby-forum.com/t/rubyscript2exe-in-cygwin-and-gets-readline-unexpected-eofer/58458 "2006-04-21T21:01:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SSSSSren\_Nils\_Schuc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e0b2c6/32.png) [@SSSSSren\_Nils\_Schuc](https://www.ruby-forum.com/u/SSSSSren_Nils_Schuc)\
**Post date:** [April 21, 2006, 9:01pm UTC](https://www.ruby-forum.com/t/rubyscript2exe-in-cygwin-and-gets-readline-unexpected-eofer/58458/1 "2006-04-21T21:01:55Z")

</div>

Hi,

I’m planning on distributing software using the very helpful  
RubyScript2Exe tool. However, I’ve found that, when used on Windows  
with Cygwin, it has some unexpected behaviour with the IO#gets /  
IO#readline method(s). A script as simple as

foo = $stdin.gets  
puts foo

reproduces this for me. Run normally, it works as expected, but when  
compiled with RubyScript2Exe, gets doesn’t do anything, and foo is  
actually nil. Using readline instead, I get an EOFError:

$ ./input-test.exe  
c:/WINNT/TEMP/eee.input-test.exe.3/app/input-test.rb:2:in `readline’:  
end of file reached (EOFError)  
from c:/WINNT/TEMP/eee.input-test.exe.3/app/input-test.rb:2  
from c:/WINNT/TEMP/eee.input-test.exe.3/bootstrap.rb:41

I suspected that $/, $\_ or $stdin might behave or be set differently  
when in this environment, but that doesn’t appear to be the case. Both  
when run through ‘normal’ Ruby as well as when compiled, $/ is \0, $\_  
returns what I wrote and $stdin is #IO:0x\*.

During the “tracing”, the test script still behaves as expected; it  
only occurs in compiled form.

Also, I cannot reproduce this problem at all when using RubyScript2Exe  
on Darwin (OS X), so it must be Cygwin-related. Due to socket blocking  
problems, I cannot use VC+±ruby or MinGW-ruby either.

I couldn’t find anything about this in the documentation or in this  
list or elsewhere on the web, but I’m probably just missing the  
obvious.

Any help greatly appreciated.
