RWebServices (version 1.36.0)

sinkSetup, sinkRetrieve: Capture and retrieve screen output

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

sinkSetup() sinkRetrieve()

Arguments

Value

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

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.

Examples

Run this code
library(RWebServices)

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

Run the code above in your browser using DataLab