Skip to main content

Command

Struct Command 

Source
pub struct Command<'a> { /* private fields */ }
Expand description

Builds a process to spawn, relaying stdio across VFS domains when a given endpoint cannot be consumed directly by the spawn target.

Implementations§

Source§

impl<'a> Command<'a>

Source

pub fn arg(&mut self, arg: &str) -> &mut Self

Appends an argument to the program invocation.

Source

pub fn env(&mut self, key: &str, val: &str) -> &mut Self

Sets an environment variable for the child.

Source

pub fn env_remove(&mut self, key: &str) -> &mut Self

Removes an environment variable from the child.

Source

pub fn current_dir(&mut self, dir: Path<'_>) -> &mut Self

Sets the child’s working directory.

Source

pub fn stdin(&mut self, stdio: StdioRecv) -> Result<&mut Self>

Sets the child’s standard input.

Source

pub fn stdout(&mut self, stdio: StdioSend) -> Result<&mut Self>

Sets the child’s standard output.

Source

pub fn stdin_inherit(&mut self) -> Result<&mut Self>

Inherit the host process’s standard input.

Opaque remote clients treat terminal input as null because Tokio cannot cancel an outstanding terminal read. Redirected input is relayed to the remote process.

Source

pub fn stdout_inherit(&mut self) -> Result<&mut Self>

Inherits the host process’s standard output.

Source

pub fn stdout_inherit_stderr(&mut self) -> Result<&mut Self>

Connects the child’s standard output to the parent process’s standard error.

Source

pub fn stdin_null(&mut self) -> &mut Self

Connects the child’s standard input to the null device.

Source

pub fn stdout_null(&mut self) -> &mut Self

Connects the child’s standard output to the null device.

Source

pub fn stderr(&mut self, stdio: StdioSend) -> Result<&mut Self>

Sets the child’s standard error.

Source

pub fn stderr_inherit(&mut self) -> Result<&mut Self>

Inherits the host process’s standard error.

Source

pub fn stderr_to_stdout(&mut self) -> Result<&mut Self>

Connects the child’s standard error to the same destination as its configured standard output.

Source

pub fn stderr_inherit_stdout(&mut self) -> Result<&mut Self>

Connects the child’s standard error to the parent process’s standard output.

Source

pub fn stderr_null(&mut self) -> &mut Self

Connects the child’s standard error to the null device.

Source

pub fn process_control(&mut self, control: ProcessControl) -> &mut Self

Sets foreground or background process control behavior.

Source

pub fn termination_policy(&mut self, policy: TerminationPolicy) -> &mut Self

Sets the policy used to terminate the child.

Source

pub async fn spawn(self) -> Result<Child>

Spawns the configured process.

Auto Trait Implementations§

§

impl<'a> !Freeze for Command<'a>

§

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

§

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

§

impl<'a> Send for Command<'a>

§

impl<'a> Sync for Command<'a>

§

impl<'a> Unpin for Command<'a>

§

impl<'a> UnsafeUnpin for Command<'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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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.