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
impl Command
pub fn new(program: &OsStr) -> Command
pub fn set_arg_0(&mut self, arg: &OsStr)
pub fn arg(&mut self, arg: &OsStr)
pub fn cwd(&mut self, dir: &OsStr)
pub fn uid(&mut self, id: uid_t)
pub fn gid(&mut self, id: gid_t)
pub fn groups(&mut self, groups: &[gid_t])
pub fn pgroup(&mut self, pgroup: pid_t)
pub fn create_pidfd(&mut self, val: bool)
pub fn get_create_pidfd(&self) -> bool
pub fn saw_nul(&self) -> bool
pub fn get_program(&self) -> &OsStr
pub fn get_program_kind(&self) -> ProgramKind
pub fn get_args(&self) -> CommandArgs<'_> ⓘ
pub fn get_envs(&self) -> CommandEnvs<'_> ⓘ
pub fn get_current_dir(&self) -> Option<&Path>
pub fn get_argv(&self) -> &Vec<*const c_char>
pub fn get_program_cstr(&self) -> &CStr
pub fn get_cwd(&self) -> &Option<CString>
pub fn get_uid(&self) -> Option<uid_t>
pub fn get_gid(&self) -> Option<gid_t>
pub fn get_groups(&self) -> Option<&[gid_t]>
pub fn get_pgroup(&self) -> Option<pid_t>
pub fn get_closures( &mut self ) -> &mut Vec<Box<dyn FnMut() -> Result<()> + Send + Sync>>
pub unsafe fn pre_exec( &mut self, f: Box<dyn FnMut() -> Result<()> + Send + Sync> )
pub fn stdin(&mut self, stdin: Stdio)
pub fn stdout(&mut self, stdout: Stdio)
pub fn stderr(&mut self, stderr: Stdio)
pub fn env_mut(&mut self) -> &mut CommandEnv
pub fn capture_env(&mut self) -> Option<CStringArray>
pub fn env_saw_path(&self) -> bool
pub fn program_is_path(&self) -> bool
pub fn setup_io( &self, default: Stdio, needs_stdin: bool ) -> Result<(StdioPipes, ChildPipes)>
source§impl Command
impl Command
pub fn spawn( &mut self, default: Stdio, needs_stdin: bool ) -> Result<(Process, StdioPipes)>
pub fn output(&mut self) -> Result<(ExitStatus, Vec<u8>, Vec<u8>)>
unsafe fn do_fork(&mut self) -> Result<(pid_t, pid_t), Error>
pub fn exec(&mut self, default: Stdio) -> Error
unsafe fn do_exec( &mut self, stdio: ChildPipes, maybe_envp: Option<&CStringArray> ) -> Result<!, Error>
fn posix_spawn( &mut self, stdio: &ChildPipes, envp: Option<&CStringArray> ) -> Result<Option<Process>>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl !UnwindSafe for Command
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more