Is there any way to capture output (both stdout and stderr) from
install.packages? Solutions like sink and capture.output don't work
because the install.packages calls out to system2 which is executed in
a separate process:
test <- capture.output(install.packages("MASS"))
The system2 function does have arguments stdout and stderr but afaik
these cannot be controlled via install.packages. I'm a bit reluctant
to start rolling my own version of install.packages just for this
reason.
Is there any way to somehow grab this output? Or alternatively, is
there a way to make R pipe stdout and stderr from system2 in such a
way that they can be captured with sink or capture.output in the R
parent process?
Duncan Murdoch
2013-Sep-23 20:20 UTC
[Rd] Capture output of install.packages (pipe system2)
On 13-09-23 2:17 PM, Jeroen Ooms wrote:> Is there any way to capture output (both stdout and stderr) from > install.packages? Solutions like sink and capture.output don't work > because the install.packages calls out to system2 which is executed in > a separate process: > > test <- capture.output(install.packages("MASS")) > > The system2 function does have arguments stdout and stderr but afaik > these cannot be controlled via install.packages. I'm a bit reluctant > to start rolling my own version of install.packages just for this > reason. > > Is there any way to somehow grab this output? Or alternatively, is > there a way to make R pipe stdout and stderr from system2 in such a > way that they can be captured with sink or capture.output in the R > parent process?See the recent thread <https://mailman.stat.ethz.ch/pipermail/r-devel/2013-September/067552.html> for an approach to this. Duncan Murdoch
Apparently Analagous Threads
- Redirect system2 stdout to a file on windows
- Problem with system2(), directing STDERR to a file
- system2 doesn't quote stdin on unix, unlike stdout, stderr & input and on Windows
- suppressing stderr output from system() calls
- type="message" possibility for capture.output() ?