Start a background process using the PowerShell cmdlet
Start-Process-PassThru
on Windows or the ampersand &
on
Unix, and return the process ID.
The system command and its arguments. They do not need to
be quoted, since they will be quoted via shQuote()
internally.
If FALSE
, suppress the output from stdout
(and also
stderr
on Windows). The default value of this argument can be set via a
global option, e.g., options(xfun.bg_process.verbose = TRUE)
.
The process ID as a character string.
On Windows, if PowerShell is not available, try to use
system2
(wait = FALSE)
to start the background process instead. The
process ID will be identified from the output of the command
tasklist
. This method of looking for the process ID may not be
reliable. If the search is not successful in 30 seconds, it will throw an
error (timeout). If a longer time is needed, you may set
options(xfun.bg_process.timeout)
to a larger value, but it should be very
rare that a process cannot be started in 30 seconds. When you reach the
timeout, it is more likely that the command actually failed.
proc_kill()
to kill a process.