Forum: Ruby RubyScript2Exe in Cygwin and gets/readline: unexpected EOFEr

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Sören Nils 'chucker' Kuklau (Guest)
on 2006-04-21 23:01
(Received via mailing list)
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.
This topic is locked and can not be replied to.