Struct tiny_std::process::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> !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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.