From: Alex Wayne Date: 2008-04-09T04:37:03+09:00 Subject: Re: System commands with streaming output Tim Hunter wrote: > Alex Wayne wrote: >> I have a long running system command that I want to print the output >> from a ruby script. Basically, this system command runs like a daemon >> and prints output. So it I just use: >> >> `./mycommand foo` >> >> The output is completely supressed, and my ruby script simply appears to >> hang. >> >> So how can I execute a system command and have the output streamed back >> to the terminal before the command finishes? > > ri IO::popen Hmm, I still can't seem to get this working. I got this: IO.popen './mycommand foo' do |f| puts f.gets end It's doing its job, but I still get no output on the terminal. And to be clear, when this command is run on its own I definitely get output. -- Posted via http://www.ruby-forum.com/.