pub struct Command {
Show 16 fields program: CString, args: Vec<CString>, argv: Argv, env: CommandEnv, program_kind: ProgramKind, cwd: Option<CString>, uid: Option<uid_t>, gid: Option<gid_t>, saw_nul: bool, closures: Vec<Box<dyn FnMut() -> Result<()> + Send + Sync>>, groups: Option<Box<[gid_t]>>, stdin: Option<Stdio>, stdout: Option<Stdio>, stderr: Option<Stdio>, create_pidfd: bool, pgroup: Option<pid_t>,
}

Fields§

§program: CString§args: Vec<CString>§argv: Argv

Exactly what will be passed to execvp.

First element is a pointer to program, followed by pointers to args, followed by a null. Be careful when modifying program or args to properly update this as well.

§env: CommandEnv§program_kind: ProgramKind§cwd: Option<CString>§uid: Option<uid_t>§gid: Option<gid_t>§saw_nul: bool§closures: Vec<Box<dyn FnMut() -> Result<()> + Send + Sync>>§groups: Option<Box<[gid_t]>>§stdin: Option<Stdio>§stdout: Option<Stdio>§stderr: Option<Stdio>§create_pidfd: bool§pgroup: Option<pid_t>

Implementations§

source§

impl Command

source

pub fn new(program: &OsStr) -> Command

source

pub fn set_arg_0(&mut self, arg: &OsStr)

source

pub fn arg(&mut self, arg: &OsStr)

source

pub fn cwd(&mut self, dir: &OsStr)

source

pub fn uid(&mut self, id: uid_t)

source

pub fn gid(&mut self, id: gid_t)

source

pub fn groups(&mut self, groups: &[gid_t])

source

pub fn pgroup(&mut self, pgroup: pid_t)

source

pub fn create_pidfd(&mut self, val: bool)

source

pub fn get_create_pidfd(&self) -> bool

source

pub fn saw_nul(&self) -> bool

source

pub fn get_program(&self) -> &OsStr

source

pub fn get_program_kind(&self) -> ProgramKind

source

pub fn get_args(&self) -> CommandArgs<'_>

source

pub fn get_envs(&self) -> CommandEnvs<'_>

source

pub fn get_current_dir(&self) -> Option<&Path>

source

pub fn get_argv(&self) -> &Vec<*const c_char>

source

pub fn get_program_cstr(&self) -> &CStr

source

pub fn get_cwd(&self) -> &Option<CString>

source

pub fn get_uid(&self) -> Option<uid_t>

source

pub fn get_gid(&self) -> Option<gid_t>

source

pub fn get_groups(&self) -> Option<&[gid_t]>

source

pub fn get_pgroup(&self) -> Option<pid_t>

source

pub fn get_closures( &mut self ) -> &mut Vec<Box<dyn FnMut() -> Result<()> + Send + Sync>>

source

pub unsafe fn pre_exec( &mut self, f: Box<dyn FnMut() -> Result<()> + Send + Sync> )

source

pub fn stdin(&mut self, stdin: Stdio)

source

pub fn stdout(&mut self, stdout: Stdio)

source

pub fn stderr(&mut self, stderr: Stdio)

source

pub fn env_mut(&mut self) -> &mut CommandEnv

source

pub fn capture_env(&mut self) -> Option<CStringArray>

source

pub fn env_saw_path(&self) -> bool

source

pub fn program_is_path(&self) -> bool

source

pub fn setup_io( &self, default: Stdio, needs_stdin: bool ) -> Result<(StdioPipes, ChildPipes)>

source§

impl Command

source

pub fn spawn( &mut self, default: Stdio, needs_stdin: bool ) -> Result<(Process, StdioPipes)>

source

pub fn output(&mut self) -> Result<(ExitStatus, Vec<u8>, Vec<u8>)>

source

unsafe fn do_fork(&mut self) -> Result<(pid_t, pid_t), Error>

source

pub fn exec(&mut self, default: Stdio) -> Error

source

unsafe fn do_exec( &mut self, stdio: ChildPipes, maybe_envp: Option<&CStringArray> ) -> Result<!, Error>

source

fn posix_spawn( &mut self, stdio: &ChildPipes, envp: Option<&CStringArray> ) -> Result<Option<Process>>

Trait Implementations§

source§

impl Debug for Command

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