Debian Codegraph @

man/bg_process.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/command.R
3 \name{bg_process}
4 \alias{bg_process}
5 \title{Start a background process}
6 \usage{
7 bg_process(
8 command,
9 args = character(),
10 verbose = getOption("xfun.bg_process.verbose", FALSE)
11 )
12 }
13 \arguments{
14 \item{command, args}{The system command and its arguments. They do not need to
15 be quoted, since they will be quoted via \code{\link[=shQuote]{shQuote()}} internally.}
16
17 \item{verbose}{If \code{FALSE}, suppress the output from \code{stdout} (and also
18 \code{stderr} on Windows). The default value of this argument can be set via a
19 global option, e.g., \code{options(xfun.bg_process.verbose = TRUE)}.}
20 }
21 \value{
22 The process ID as a character string.
23 }
24 \description{
25 Start a background process using the PowerShell cmdlet
26 \command{Start-Process-PassThru} on Windows or the ampersand \command{&} on
27 Unix, and return the process ID.
28 }
29 \note{
30 On Windows, if PowerShell is not available, try to use
31 \code{\link{system2}}\code{(wait = FALSE)} to start the background process instead. The
32 process ID will be identified from the output of the command
33 \command{tasklist}. This method of looking for the process ID may not be
34 reliable. If the search is not successful in 30 seconds, it will throw an
35 error (timeout). If a longer time is needed, you may set
36 \code{options(xfun.bg_process.timeout)} to a larger value, but it should be very
37 rare that a process cannot be started in 30 seconds. When you reach the
38 timeout, it is more likely that the command actually failed.
39 }
40 \seealso{
41 \code{\link[=proc_kill]{proc_kill()}} to kill a process.
42 }