async (version 0.0.0.9004)

run_process: Asynchronous external process execution

Description

Start an external process in the background, and report its completion via a deferred.

Usage

run_process(command = NULL, args = character(),
  error_on_status = TRUE, wd = NULL, env = NULL,
  windows_verbatim_args = FALSE, windows_hide_window = FALSE,
  encoding = "")

Arguments

command

Character scalar, the command to run.

args

Character vector, arguments to the command.

error_on_status

Whether to reject the referred value if the program exits with a non-zero status.

wd

Working directory of the process. If NULL, the current working directory is used.

env

Environment of the child process, a named character vector. IF NULL, the environment of the parent is inherited.

windows_verbatim_args

Whether to omit the escaping of the command and the arguments on windows. Ignored on other platforms.

windows_hide_window

Whether to hide the window of the application on windows. Ignored on other platforms.

encoding

The encoding to assume for stdout and stderr. By default the encoding of the current locale is used. Note that processx always reencodes the output of both streams in UTF-8 currently.

Value

Deferred object.

Examples

Run this code
# NOT RUN {
afun <- function() {
  run_process("ls", "-l")$
    then(function(x) strsplit(x$stdout, "\r?\n")[[1]])
}
synchronise(afun())
# }

Run the code above in your browser using DataLab