On Wed, Oct 19, 2016 at 08:34:09PM +0200, Christof Warlich wrote:
> Thanks for the quick response: Thus, as much as I understand,
> a line-oriented piped reader approach would avoid mixing output
> of stdout and stderr _within_ lines, but the sequence of whole lines
> w.r.t. stdout and stderr may still be garbeled ...?!
Yes, that's correct. Imagine the two readers each receive one line,
a microsecond apart. If the kernel's scheduling causes one of them
to delay by 2 microseconds, it'll write its line last. Over the
course of a very long run, this could cause a few unexpected line
order switches.
> That's really rather disappointing: My idea was to make the
> sequence of commnds executed by my scripts (and possible
> errors) visible on the terminal by employing set -x, while writing
> a logfile containing _all_ information for "debugging" purpose
> if needed.
This seems strange to me. I would expect the set -x output to be
much greater in size than the regular output, for most scripts.
So, suppressing stdout on the terminal doesn't seem like it would
help you a lot.
> This would be particularly usefull for scripts that produce loads
> of output, e.g. when generating toolchains.
I guess I never deal with that kind of script.