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

Re: BASH Redirect (STDOUT & STDERR) Syncing



On Tue, 2005-04-12 at 05:09 +0200, Bruno Hertz wrote:
> Hal Vaughan <hal@thresholddigital.com> writes:
> 
> > I'm running a Perl script and redirecting the output to a file, and 
> > redirecting STDERR to the same file, like this:
> >
> > 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?
> 
> Hey
> 
> this is a wild guess coming now, but I'm posting it just to compare it
> to what finally comes out as being right.
> 
> 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.

Actually, I've noticed this for many things I've run from the cmd line
in Debian (and have noticed it not happening for other Unices)... the
only thing that springs to mind at the moment is output from 'make'
having std err and std out well out of sync.... any ideas what might be
going on here? (Debian GNU/Linux, 2.4.27-1-686-smp, Sarge apt updates)

Ta, michael



Reply to: