sinkSetup: Capture and retrieve screen output

Description Usage Details Value Author(s) Examples

Description

sinkSetup establishes temporary files to capture output that would normally be directed toward the screen, and redirects both standard and error output to these files. sinkRetrieve retrieves the output, and removes screen redirections so output again appears on the screen.

Usage

1
2

Details

These functions are used to redirect and then retrieve screen output. Redirection is to objects created with file, with no arguments (i.e., a temporary file, unlinked from the file system). Both standard output and error output are redirected.

User-level calls of sink between calls to sinkSetup and sinkRetrieve may confuse screen (especially error) capture, likely resulting in warnings when sinkRetrieve is called.

Value

sinkRetrieve returns an object of SinkOutput-class, the slots of which contain vectors of the lines of text directed toward the screen.

Author(s)

MT Morgan

Examples

1
2
3
4
5
6
7
8
library(RWebServices)

sinkSetup()
ls()
try( fails())
f <- function() stop("fails in function f")
try( f())
sinkRetrieve()

RWebServices documentation built on Oct. 5, 2016, 4:53 a.m.