Description Usage Arguments Details Value
Function robust_system
provide easy way how to catch stdout, stderr and
exit status from external application. It builds on base::system2
and utilize it internally. It catch stdout
and stderr
of
command ran by system2
by redirecting them into temporary file and
reading them with readLines
.
1 2 |
command |
external program to run, same as |
args |
arguments for external program, same as |
dir |
directory that will be used, if not specified, R's temporary directory is used. |
keep_temp |
if temporary files with |
stdout_read |
parameters to be passed to |
stderr_read |
parameters to be passed to |
... |
other parameters passed to |
Function robust_system
works by redirecting stdout
and
stderr
to temporary files, either in R's temporary directory, which
is deleted after R's session ends, or in user specified directory.
Parameters command
and args
are directly passed to
system2
, as well as any other optional parameters passed as ...
.
If keep_temp=FALSE
, temporary files are deleted, but directory is
deleted only if it was created by this function. This makes function clean
after itself, but might be problematic if used in parallel.
With stdout_read
and stderr_read
, you can pass additional
parameters to readLines
function, should as warn=TRUE
, as
readLines
throw warning whenever line doesn't end with a newline.
list with stdout
, sderr
, exit code and if
keep_temp=TRUE
path to temporary files.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.