From: Sean O'Halpin Date: 2013-05-08T20:38:04+09:00 Subject: Re: File Problem with pty and irb You're not waiting for the child process in cmd.rb so it's killed when the ruby process finishes. Try: require 'pty' @rbOut, @rbIn, @pid = PTY.spawn('mycode') Process.waitpid(@pid) Regards, Sean On Wed, May 8, 2013 at 12:46 AM, Admin Tensor wrote: > Hi, > > I have a C code that writes to a fifo file (a named pipe), and when I > just run it directly, it is fine: > > Screen 1: ./mycode > (running) > > Screen 2: cat < namedpipe > (a lot of outputs) > > But when I try to run it via irb, it doesn't give me the output: > > Screen 1: irb -r cmd.rb > irb(main):001:0> > (the code is running in the background) > > Screen 2: cat < namedpipe > (nothing) > > and cmd.rb is basically > > require 'pty' > @rbOut, @rbIn, @pid = PTY.spawn('mycode') > > It looks that the code is running, because I can give the command in > Screen 1 and the results are fine and indicate progress. Is there any > way to make mycode to output to namedpipe under irb? Thanks. > > Best regards, > > Bill > > -- > Posted via http://www.ruby-forum.com/. >