From jeroen.ooms at stat.ucla.edu  Tue Sep 24 20:00:42 2013
From: jeroen.ooms at stat.ucla.edu (Jeroen Ooms)
Date: Tue, 24 Sep 2013 14:00:42 -0400
Subject: [Rd] Capture output of install.packages (pipe system2)
In-Reply-To: <F165061B-F2DF-47CF-898F-920DC27C0DF7@r-project.org>
References: <CABFfbXtWhc48KviWCQXR84xGywm1GU0oMWk1Vk7s0EqbcAfT5g@mail.gmail.com>
	<5240A280.1000804@gmail.com>
	<F165061B-F2DF-47CF-898F-920DC27C0DF7@r-project.org>
Message-ID: <CABFfbXtorSxOrjaxeWFpeuvxPikKdBXxUO=C1JQAWBUcpt0+qQ@mail.gmail.com>

On Mon, Sep 23, 2013 at 6:34 PM, Simon Urbanek
<simon.urbanek at r-project.org> wrote:
> On top of my head for full capture I can only think of custom C code that will re-direct stderr/out FDs as desired (it's really trivial to re-direct to files, for dynamic capture it's a little more involved but there are examples that do that).

I had secretly been hoping that system2("whoami", stdout=stdout(),
stderr=stderr()) would capture output streams from the child process
and concatenate to stdout() and stderr() in the parent just as if they
were sent by cat("foo", file=stdout()) and cat("bar", file=stderr())
such that they could be captured from sink() in the parent. However
thinking twice about this, it is probably very difficult to implement
without threads. The event loop in the parent process would need to
poll for buffered output in the child while waiting for it to return
or something.



[Rd] Capture output of install.packages (pipe system2)
Jeroen Ooms