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<&CStr>
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)>
unsafe fn do_fork(&mut self) -> Result<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>>
fn send_pidfd(&self, sock: &Socket)
fn recv_pidfd(&self, sock: &Socket) -> pid_t
Trait Implementations§
Source§impl AsInnerMut<Command> for Command
impl AsInnerMut<Command> for Command
fn as_inner_mut(&mut self) -> &mut Command
Auto Trait Implementations§
impl Freeze for Command
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
Source§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)] const IS_ZST: bool = _
#[doc(hidden)] const IS_ZST: bool = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)Source§#[doc(hidden)] const LAYOUT: Layout = _
#[doc(hidden)] const LAYOUT: Layout = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)Source§#[doc(hidden)] const MAX_SLICE_LEN: usize = _
#[doc(hidden)] const MAX_SLICE_LEN: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)The largest safe length for a
[Self]
. Read more