Struct libuv::handles::process::ProcessOptions
source · pub struct ProcessOptions<'a> {
pub exit_cb: ExitCB<'static>,
pub file: &'a str,
pub args: &'a [&'a str],
pub env: Option<&'a [&'a str]>,
pub cwd: Option<&'a str>,
pub flags: ProcessFlags,
pub stdio: &'a [StdioContainer],
pub uid: Uid,
pub gid: Gid,
}
Expand description
Options for spawning the process (passed to spawn()).
Fields§
§exit_cb: ExitCB<'static>
Called after the process exits.
file: &'a str
Path to program to execute.
args: &'a [&'a str]
Command line arguments. args[0] should be the path to the program. On Windows this uses CreateProcess which concatenates the arguments into a string this can cause some strange errors. See the note at windows_verbatim_arguments.
env: Option<&'a [&'a str]>
This will be set as the environ variable in the subprocess. If this is None then the parents environ will be used.
cwd: Option<&'a str>
If Some() this represents a directory the subprocess should execute in. Stands for current working directory.
flags: ProcessFlags
Various flags that control how spawn() behaves. See the definition of ProcessFlags
.
stdio: &'a [StdioContainer]
The stdio
field points to an array of StdioContainer structs that describe the file
descriptors that will be made available to the child process. The convention is that
stdio[0] points to stdin, fd 1 is used for stdout, and fd 2 is stderr.
Note that on windows file descriptors greater than 2 are available to the child process only if the child processes uses the MSVCRT runtime.
uid: Uid
Libuv can change the child process’ user/group id. This happens only when the appropriate bits are set in the flags fields. This is not supported on windows; spawn() will fail and set the error to ENOTSUP.
gid: Gid
Libuv can change the child process’ user/group id. This happens only when the appropriate bits are set in the flags fields. This is not supported on windows; spawn() will fail and set the error to ENOTSUP.
Implementations§
source§impl<'a> ProcessOptions<'a>
impl<'a> ProcessOptions<'a>
sourcepub fn new(args: &'a [&'a str]) -> ProcessOptions<'_>
pub fn new(args: &'a [&'a str]) -> ProcessOptions<'_>
Constructs a new ProcessOptions object. The args slice must have at least one member: the path to the program to execute. Any additional members of the slice will be passed as command line arguments.