File: bg_process.Rd

package info (click to toggle)
r-cran-xfun 0.20-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 680 kB
  • sloc: ansic: 242; sh: 22; makefile: 2
file content (40 lines) | stat: -rw-r--r-- 1,513 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/command.R
\name{bg_process}
\alias{bg_process}
\title{Start a background process}
\usage{
bg_process(command, args = character())
}
\arguments{
\item{command, args}{The system command and its arguments. They do not need to
be quoted, since they will be quoted via \code{\link{shQuote}()}
internally.}
}
\value{
The process ID as a character string.
}
\description{
Start a background process using the PowerShell cmdlet \command{Start-Process
-PassThru} on Windows or the ampersand \command{&} on Unix, and return the
process ID.
}
\details{
If you need to see the output from \verb{stdout} and \verb{stderr}, you may
set \code{options(xfun.bg_process.verbose = TRUE)} before starting the
process. By default, these outputs are hidden.
}
\note{
On Windows, if PowerShell is not available, try to use
  \code{\link{system2}(wait = FALSE)} to start the background process
  instead. The process ID will be identified from the output of the command
  \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
  \code{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.
}
\seealso{
\code{\link{proc_kill}()} to kill a process.
}