[Top][All Lists]

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

Re: Redirecting standard output

From: Eli Zaretskii
Subject: Re: Redirecting standard output
Date: Thu, 21 Apr 2011 17:10:54 +0300

> From: Lars Magne Ingebrigtsen <address@hidden>
> Date: Thu, 21 Apr 2011 15:25:29 +0200
> However, redirecting STDERR to a buffer seems like it would be quite
> complicated, unfortunately.  I thought that having STDOUT and STDERR be
> handled symmetrically would be a nice feature (for redirecting STDOUT to
> one buffer and STDERR to another, for instance), but unless I'm reading
> the code wrong (and I very well could be), I don't see an obvious way to
> do that.

On Posix systems, we use a pipe to read from subprocess's STDOUT.  You
cannot do the same with STDERR, but you can redirect STDERR to a
temporary file, and then read it when the subprocess exits.  You can
refactor the part of call-process that reads STDOUT and decodes it,
and reuse it for STDERR (only reading from a file).

Btw, I think the reason why no one implemented that till now is that
STDERR normally isn't interesting, unless the subprocess exits with an
error code, in which case reading the text from the temporary file to
which STDERR was redirected is easy.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]