Dear list,
I'm trying to suppress/redirect/squash the output from commands like 
install.packages, or download.file. The problem is that none of: sink(..., 
type="message"), sink(..., type="output"), capture.output, suppressMessages are 
quite doing the trick. Output gets written to the stderr stream, despite any 
combination of the above suppression commands.
According to ?sink:
Messages sent to ‘stderr()’ (including those from ‘message’, ‘warning’ and 
‘stop’) can be diverted by ‘sink(type = "message")’ (see below).

I'm pretty sure it's the system(), or .Internal() calls which are the culprit, 
which currently write the majority (all?) of their output to the stderr stream.

Simple example:
con <- file("stderr.txt", "w")
sink(con, type="message")
system("ls")
sink(NULL, type="message")
close(con)
# instead of the output going to stderr.txt, it gets printed to the console.

# no good either
capture.output(system("ls"))
character(0)

This is an issue, since i'm writing GenePattern modules to run R code, and if 
anything is written to stderr, then the job gets hit with a 'job failed' 
status, when all that might have happened is an R package got installed, or a 
file got downloaded via FTP.

Any ideas? Can system() and .Internal() output be redirected to stdout?

cheers,
Mark


sessionInfo()
R version 2.13.1 (2011-07-08)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] en_AU.UTF-8/en_AU.UTF-8/C/C/en_AU.UTF-8/en_AU.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
> 



-----------------------------------------------------
Mark Cowley, PhD

Pancreatic Cancer Program | Peter Wills Bioinformatics Centre
Garvan Institute of Medical Research, Sydney, Australia
-----------------------------------------------------


        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to