Struct gaol::sandbox::Command

source ·
pub struct Command {
    pub module_path: CString,
    pub args: Vec<CString>,
    pub env: HashMap<CString, CString>,
}

Fields§

§module_path: CString

A path to the executable.

§args: Vec<CString>

The arguments to pass.

§env: HashMap<CString, CString>

The environment of the process.

Implementations§

source§

impl Command

source

pub fn new<T>(module_path: T) -> Command
where T: AsRef<OsStr>,

Constructs a new Command for launching the executable at path module_path with no arguments and no environment by default. Builder methods are provided to change these defaults and otherwise configure the process.

source

pub fn me() -> Result<Command>

Constructs a new Command for launching the current executable.

source

pub fn arg<'a, T>(&'a mut self, arg: T) -> &'a mut Command
where T: AsRef<OsStr>,

Adds an argument to pass to the program.

source

pub fn args<'a, T>(&'a mut self, args: &[T]) -> &'a mut Command
where T: AsRef<OsStr>,

Adds multiple arguments to pass to the program.

source

pub fn env<'a, T, U>(&'a mut self, key: T, val: U) -> &'a mut Command
where T: AsRef<OsStr>, U: AsRef<OsStr>,

Inserts or updates an environment variable mapping.

source

pub fn spawn(&self) -> Result<Process>

Executes the command as a child process, which is returned.

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