From: Rob Biedenharn Date: 2008-06-01T04:09:26+09:00 Subject: Re: getting standard error and output from ruby script in real time On May 31, 2008, at 12:16 PM, Stefano Crocco wrote: > On Saturday 31 May 2008, Rob Biedenharn wrote: > >> $stdout.sync = true; $stdout.flush >> >> The #sync setting of true means "unbuffered" (sync'd to the >> destination every time). If you build up messages, you can call >> #flush on the IO yourself instead. >> >> print "hello " >> print "world" >> puts "!" >> STDOUT.flush > > I don't think that would work. If I understand correctly what you > mean, that > should be put in the script which produces the output, not not in > the one > displaying it. But since the output I want to display is from a > script written > by the user, I can't do that. > > Stefano If you have no need to maintain separate streams do the equivalent of the shell's: 2>&1 so that stderr is the same as stdout. $stderr.reopen($stdout) You might want to do that in your child process before exec'ing the user's script. -Rob Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com