From: Joe Van Dyk Date: 2005-10-14T08:53:50+09:00 Subject: Re: Buffering problems On 10/13/05, Joe Van Dyk wrote: > On 10/13/05, Ara.T.Howard wrote: > > On Fri, 14 Oct 2005, Joe Van Dyk wrote: > > > > > I'm trying to redirect stdout and stderr of a program to a log file. > > > > > > So, I'm doing something like: > > > > > > $stdout.sync = true > > > $stderr.sync = true > > > $stdout.reopen File.open(some_log_file, "w") > > > $stderr.reopen File.open(some_log_file, "w") > > > > > > exec 'program' > > > > > > Standard out and error are being redirected to the log file, but they > > > are being buffered. > > > > > > Any ideas on why that might be? > > > > did you mean > > > > $stdout.reopen File.open(some_log_file, "w") > > $stderr.reopen File.open(some_log_file, "w") > > $stdout.sync = true > > $stderr.sync = true > > No. Why would the ordering make a difference? And switching putting the sync calls after the reopen didn't seem to make a difference.