From: Christian von Mueffling Date: 2003-03-07T01:55:25+09:00 Subject: Re: system command expansion after PTY.spawn On Fri, Mar 07, 2003 at 12:18:20AM +0900, Yukihiro Matsumoto wrote: > |require 'pty' > |pty_read, pty_write, pid = PTY.spawn( "irb" ) > |`uname` > > This works with 1.8. 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 ---------------------------------------------- and with ruby 1.6.8 in: ---------------------------------------------- 11323 irb(main):001:0> 11324 /users/cvm/local/gnu/ruby-1.6.8/lib/ruby/1.6/expect.rb:13:in `select': Child_changed: 11323 (RuntimeError) from /users/cvm/local/gnu/ruby-1.6.8/lib/ruby/1.6/expect.rb:13:in `expect' from t.rb:13 ---------------------------------------------- It works if i don't comment out the last 3 lines of each block (but thenthe processes then are alive until the script ends :-(). Do I use this in a wrong way? -- chris