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
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:
end of file reached (EOFError)
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
Any help greatly appreciated.