Struct Command

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

Implementations§

Source§

impl<'a> Command<'a>

Source

pub fn new(bin: &'a UnixStr) -> Result<Self>

Constructs a new command, setting the first argument as the binary’s name

§Errors

If the string is not C string compatible

Source

pub fn env(&mut self, env: UnixString) -> &mut Self

§Errors

If the string is not C string compatible

Source

pub fn envs(&mut self, envs: impl Iterator<Item = UnixString>) -> &mut Self

§Errors

If the string is not C string compatible

Source

pub fn arg(&mut self, arg: &'a UnixStr) -> &mut Self

§Errors

If the string is not C string compatible

Source

pub fn args(&mut self, args: impl Iterator<Item = &'a UnixStr>) -> &mut Self

§Errors

If the string is not C string compatible

Source

pub unsafe fn pre_exec<F: FnMut() -> Result<()> + Send + Sync + 'static>( &mut self, f: F, ) -> &mut Self

A function to run after forking off the process but before the exec call

§Safety

Some things, such as some memory access will immediately cause UB, keep it simple, short, and sweet.

Source

pub fn cwd(&mut self, dir: &'a UnixStr) -> &mut Self

§Errors

If the string is not C string compatible

Source

pub fn uid(&mut self, id: UidT) -> &mut Self

Source

pub fn gid(&mut self, id: GidT) -> &mut Self

Source

pub fn pgroup(&mut self, pgroup: PidT) -> &mut Self

Source

pub fn stdin(&mut self, stdin: Stdio) -> &mut Self

Source

pub fn stdout(&mut self, stdout: Stdio) -> &mut Self

Source

pub fn stderr(&mut self, stderr: Stdio) -> &mut Self

Source

pub fn spawn(&mut self) -> Result<Child>

Spawns a new child process from this command.

§Errors

See spawn

Source

pub fn exec(&mut self) -> Error

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<'a> !UnwindSafe 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

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.