From: matz@... (Yukihiro Matsumoto) Date: 2003-03-07T02:46:17+09:00 Subject: Re: system command expansion after PTY.spawn Hi, In message "Re: system command expansion after PTY.spawn" on 03/03/07, Christian von Mueffling writes: |But i get still strange things here: | |---------------------------------------------- |require 'pty' |require 'expect' | |i, o, pid = PTY.spawn( "irb" ) |p pid |puts i.expect( "irb(main):001:0> " ) |o.print( "exit\n" ) |i.close |o.close | |i, o, pid = PTY.spawn( "irb" ) |p pid |puts i.expect( "irb(main):001:0> " ) |o.print( "exit\n" ) |i.close |o.close |---------------------------------------------- | | |This results with ruby 1.8.0 in: |---------------------------------------------- |11301 |irb(main):001:0> |11303 |t.rb:4:in `expect': pty - exit: 11301 (PTY::ChildExited) | from t.rb:13 |---------------------------------------------- I think it's the original design by A.Ito, the author of pty. You have to protect PTY.spawn like: begin PTY.spawn( "irb" ) do |i,o,pid| p pid puts i.expect( "irb(main):001:0> " ) o.print( "exit\n" ) i.close o.close end rescue p $! end If you want to know the reason of this design, you have to ask him. I think he still can be reached at the address in the ext/pty/README, although I haven't seen him around for a while. matz.