[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: BASH Redirect (STDOUT & STDERR) Syncing



On Tue, Apr 12, 2005 at 05:09:35AM +0200, Bruno Hertz wrote:
> Hal Vaughan <hal@thresholddigital.com> writes:
> > myprog >capture.txt 2>&1
> >
> > And I've noticed that the error output is not in sync with STDOUT.  Is there 
> > any way, when doing a redirect like this, to synchronize the output, so I can 
> > tell when (in relation to STDOUT) the error messages were output?
> 
> They aren't 'in sync', as you call it, presumably because of the
> output buffering done in Perl, where one channel, either stdout or
> stdin, receives significant less output than the other and hence
> flushes more seldom.
> 
> IIRC, there's something like an operation $| or similar, 

excactly.  Just set "$|=1" (autoflush) in your Perl code.

Almut



Reply to: