run_remote
- Runs the command locally or remotely using ssh.In run_remote
the remote commands are enclosed in wrappers that allow to capture output.
By default stderr is redirected to stdout.
If there's a genuine error, e.g., the remote command does not exist, the output is not captured. In this case, one can
see the output by setting intern
to FALSE
. However, when the command is run but exits with non-zero code,
run_remote
intercepts the generated warning and saves the output.
run_remote(
command,
remote = FALSE,
args = character(),
verbose = FALSE,
shell = FALSE
)
Command to run. If run locally, quotes should be escaped once. If run remotely, quotes should be escaped twice.
Remote machine specification for ssh, in format such as user@server
that does not
require interactive password entry. For local execution, pass FALSE
(default). For
execution on the default qsub config remote, use TRUE
.
Character vector, arguments to the command.
If TRUE
prints the command.
Whether to execute the command in a shell
A list with components:
status
The exit status of the process. If this is NA, then the process was killed and had no exit status.
stdout
The standard output of the command, in a character scalar.
stderr
The standard error of the command, in a character scalar.
elapsed_time
The number of seconds required before this function returned an output.
Warnings are really errors here so the error flag is set if there are warnings.
The remote command will be put inside double quotes twice, so all quotes in cmd must be escaped twice: \\"
.
However, if the command is not remote, i.e., remote
is NULL
or empty string, quotes should be escaped
only once.
If the command itself redirects output, the stderr_redirect
flag should be set to FALSE
.