From: Dave Thomas Date: 2008-11-04T03:54:38+09:00 Subject: [ruby-core:19687] Re: [Bug #694] eof? call on a pty IO object causes application to exit On Oct 31, 2008, at 1:39 AM, Dave Thomas wrote: > > On Oct 31, 2008, at 12:28 AM, Yukihiro Matsumoto wrote: > >> pty uses exceptions to notify the process exit. In my case, it >> terminated because I don't have /usr/bin/irb installed (it's renamed >> to /usr/bin/irb1.8). >> >> What do you expect? Checking eof without raising exception? > > That's what 1.8 seems to do. > > Here's a slightly different version: > > dave[~ 1:39:37] cat t.rb > require 'pty' > > PTY.spawn("/bin/echo hello") do |reader, writer, pid| > reader.eof? > puts reader.gets > end > > dave[~ 1:39:43] ruby -v t.rb > ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0] > hello > > dave[~ 1:39:45] /usr/local/rubybook/bin/ruby -v t.rb > ruby 1.9.0 (2008-10-29 revision 15427) [i386-darwin9.5.0] > t.rb:4:in `eof?': pty - exited: 731 (PTY::ChildExited) > from t.rb:4:in `block in
' > from t.rb:3:in `spawn' > from t.rb:3:in `
' I wonder if the problem is that pty.c doesn't release the global lock, and therefore any output from the subthread that's running the shell is never seen? Dave