Skip to main content

ProcessSpec

Struct ProcessSpec 

Source
pub struct ProcessSpec {
Show 13 fields pub program: OsString, pub args: Vec<OsString>, pub env: Vec<(OsString, OsString)>, pub env_clear: bool, pub cwd: Option<PathBuf>, pub stdio: [ProcessStdio; 3], pub extra: Vec<ChildFd>, pub uid: Option<u32>, pub gid: Option<u32>, pub new_process_group: bool, pub windows_hide: bool, pub detached: bool, pub controlling_terminal: bool,
}
Expand description

Child launch options. Arguments exclude argv[0], which is the program name. Environment entries override inherited values unless env_clear is true.

Fields§

§program: OsString

Executable path or name resolved using PATH.

§args: Vec<OsString>

Arguments after argv[0].

§env: Vec<(OsString, OsString)>

Environment additions or overrides.

§env_clear: bool

Start from an empty environment.

§cwd: Option<PathBuf>

Child working directory; None inherits the host directory.

§stdio: [ProcessStdio; 3]

Child stdin, stdout and stderr, in that order.

§extra: Vec<ChildFd>

Additional child descriptors beyond stdin/stdout/stderr, at fixed child descriptor numbers. This is the tail of Node’s stdio array: entry stdio[3] of ['pipe','pipe','pipe','ipc'] is ChildFd number 3. Empty by default; Driver::spawn refuses a non-empty list, because the parent ends have nowhere to go. Use Driver::spawn_extra.

§uid: Option<u32>

Unix user ID; unsupported platforms reject this option.

§gid: Option<u32>

Unix group ID; unsupported platforms reject this option.

§new_process_group: bool

Create an isolated process group (Windows Job Object) for tree termination.

§windows_hide: bool

Hide child windows on Windows (Node’s windowsHide); ignored elsewhere. Defaults to false. With inherited stdio the console stays attached, even when true; with only pipes/null streams Windows uses CREATE_NO_WINDOW.

§detached: bool

Prepare the child to outlive the parent process (Node’s detached). Windows creates a detached process group and excludes it from the parent’s lifetime job; Unix creates a new session and process group. Defaults false. This does not unref the child or change turnloop’s explicit ownership: closing the child or dropping its owning loop still terminates a live child.

§controlling_terminal: bool

Make the child’s stdin its controlling terminal (Unix TIOCSCTTY), which is what a pty child needs so that job control, /dev/tty and terminal signals work inside it. Requires detached, because only a session leader with no controlling terminal may claim one; without it the spawn is InvalidInput. Windows has no equivalent and reports Unsupported. Defaults to false.

Implementations§

Source§

impl ProcessSpec

Source

pub fn new(program: impl Into<OsString>) -> Self

Launch a program with inherited environment, directory and standard streams.

Trait Implementations§

Source§

impl Clone for ProcessSpec

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProcessSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.