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>

source

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.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for ProcessOptions<'a>

§

impl<'a> !Send for ProcessOptions<'a>

§

impl<'a> !Sync for ProcessOptions<'a>

§

impl<'a> Unpin for ProcessOptions<'a>

§

impl<'a> !UnwindSafe for ProcessOptions<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.