Start a background process
Start a background process using the PowerShell cmdlet Start-Process
-PassThru
on Windows or the ampersand &
on Unix, and return the
process ID.
bg_process( command, args = character(), verbose = getOption("xfun.bg_process.verbose", FALSE) )
command, args |
The system command and its arguments. They do not need to
be quoted, since they will be quoted via |
verbose |
If |
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.
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.