[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: Fri, 22 Apr 2011 01:50:47 -0400

> From: Lars Magne Ingebrigtsen <address@hidden>
> Date: Thu, 21 Apr 2011 21:31:58 +0200
> Davis Herring <address@hidden> writes:
> > You can call `pipe' more than once; the trouble comes when you have to
> > choose which one to read from to avoid blocking the process.  Probably
> > it's just that no one has bothered to implement it carefully enough with
> > `select' or so.
> Oh, I see...  I was a bit confused about how pipe worked.  Yes, that
> makes sense.  Just hook up the STDERR endpoint to a pipe, too, and
> you're in business.
> For the MSDOS case (with STDERR-to-buffer), we'd just have to open
> another temp file, just like we do with STDOUT, so that's a very minor
> change.
> For the non-MSDOS case, using two pipes and select shouldn't be too
> difficult to implement, I think?

You are in danger of reinventing the wait_reading_process_output
wheel.  I'm not sure that kind of complexity is justified for such a
marginal need, just for the sake of theoretical completeness and/or
symmetry between stdout and stderr.  I think redirecting to a
temporary file and then reading from there is more than adequate, and
all but indistinguishable from the user POV (since we wait for the
process to exit anyway).

> Or are there gotchas when using select in Emacs?

wait_reading_process_output already uses select, so adding another one
is probably not a good idea.

reply via email to

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