Standard out and error are being redirected to the log file, but they
are being buffered.
Any ideas on why that might be?
------------------------------------------------------------------------
Immediately writes all buffered data in _ios_ to disk. Returns
+nil+ if the underlying operating system does not support
_fsync(2)_. Note that +fsync+ differs from using +IO#sync=+. The
latter ensures that data is flushed from Ruby's buffers, but
doesn't not guarantee that the underlying operating system actually
writes it to disk.
I'm running on Linux. Is there any way to force the OS to write data
from Ruby's buffers to the disk all that time?
Standard out and error are being redirected to the log file, but they
are being buffered.
Any ideas on why that might be?
--
email :: ara [dot] t [dot] howard [at] noaa [dot] gov
phone :: 303.497.6469
Your life dwells amoung the causes of death
Like a lamp standing in a strong breeze. --Nagarjuna
On 10/13/05, Ara.T.Howard <Ara.T.Howard@noaa.gov> 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?
And switching putting the sync calls after the reopen didn't seem to
make a difference.
···
On 10/13/05, Joe Van Dyk <joevandyk@gmail.com> wrote:
On 10/13/05, Ara.T.Howard <Ara.T.Howard@noaa.gov> 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