Description Usage Arguments Details
The inverse of callr
; this makes it easy to call a
system command from R and have it behave.
1 2 |
command |
The system command to be invoked, as a character
string. |
args |
A character vector of arguments to |
env |
A character vector of name=value pairs to be set as
environment variables (see |
max_lines |
Maximum number of lines of program output to
print with the error message. We may prune further to get the
error message under |
p |
Fraction of the error message to show from the tail of the output if truncating on error (default is 20% lines are head, 80% is tail). |
stdout,stderr |
Passed to |
locate_command |
The |
This function uses system2
to call a system command fairly
portably. What it adds is a particular way of dealing with
errors. call_system
runs the command command
with
arguments args
(and with optionally set environment
variables env
) and hides all produced output to
stdout and stderr. If the command fails (currently any nonzero
exit code is counted as a failure) then call_system
will
throw an R error giving
the full string of the command run
the exit code of the command
any errmsg
attribute that might have been returned
all output that the program produced to either stdout and stderr
This means that a successful invocation of a program produces no output while the unsuccessful invocation throws an error and prints all information to the screen (though this is delayed until failure happens).
call_system
also returns the contents of both stderr and
stdout invisibly so that it can be inspected if needed.
The function run_system
does the same thing and will be
removed as soon as code that depends on it is out of use.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.