Struct Command

pub struct Command { pub(in ::sys::process::unix::common) program: CString, pub(in ::sys::process::unix::common) args: CStringArray, pub(in ::sys::process::unix::common) env: CommandEnv, pub(in ::sys::process::unix::common) program_kind: ProgramKind, pub(in ::sys::process::unix::common) cwd: Option<CString>, pub(in ::sys::process::unix::common) chroot: Option<CString>, pub(in ::sys::process::unix::common) uid: Option<uid_t>, pub(in ::sys::process::unix::common) gid: Option<gid_t>, pub(in ::sys::process::unix::common) saw_nul: bool, pub(in ::sys::process::unix::common) closures: Vec<Box<dyn FnMut() -> Result<()> + Send + Sync>>, pub(in ::sys::process::unix::common) groups: Option<Box<[gid_t]>>, pub(in ::sys::process::unix::common) stdin: Option<Stdio>, pub(in ::sys::process::unix::common) stdout: Option<Stdio>, pub(in ::sys::process::unix::common) stderr: Option<Stdio>, pub(in ::sys::process::unix::common) create_pidfd: bool, pub(in ::sys::process::unix::common) pgroup: Option<pid_t>, pub(in ::sys::process::unix::common) setsid: bool }

Fields

program: CString
args: CStringArray
env: CommandEnv
program_kind: ProgramKind
cwd: Option<CString>
chroot: 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>
setsid: bool

Implementations

impl Command

fn new(program: &OsStr) -> Command
fn set_arg_0(&mut self, arg: &OsStr)
fn arg(&mut self, arg: &OsStr)
fn cwd(&mut self, dir: &OsStr)
fn uid(&mut self, id: uid_t)
fn gid(&mut self, id: gid_t)
fn groups(&mut self, groups: &[gid_t])
fn pgroup(&mut self, pgroup: pid_t)
fn chroot(&mut self, dir: &Path)
fn setsid(&mut self, setsid: bool)
fn create_pidfd(&mut self, val: bool)
fn get_create_pidfd(&self) -> bool
fn saw_nul(&self) -> bool
fn get_program(&self) -> &OsStr
fn get_program_kind(&self) -> ProgramKind
fn get_args(&self) -> CommandArgs<'_>
fn get_envs(&self) -> CommandEnvs<'_>
fn get_env_clear(&self) -> bool
fn get_resolved_envs(&self) -> CommandResolvedEnvs
fn get_current_dir(&self) -> Option<&Path>
fn get_argv(&self) -> &CStringArray
fn get_program_cstr(&self) -> &CStr
fn get_cwd(&self) -> Option<&CStr>
fn get_uid(&self) -> Option<uid_t>
fn get_gid(&self) -> Option<gid_t>
fn get_groups(&self) -> Option<&[gid_t]>
fn get_pgroup(&self) -> Option<pid_t>
fn get_chroot(&self) -> Option<&CStr>
fn get_setsid(&self) -> bool
fn get_closures(&mut self) -> &mut Vec<Box<dyn FnMut() -> Result<()> + Send + Sync>>
unsafe fn pre_exec(&mut self, f: Box<dyn FnMut() -> Result<()> + Send + Sync>)
fn stdin(&mut self, stdin: Stdio)
fn stdout(&mut self, stdout: Stdio)
fn stderr(&mut self, stderr: Stdio)
fn env_mut(&mut self) -> &mut CommandEnv
fn capture_env(&mut self) -> Option<CStringArray>
fn env_saw_path(&self) -> bool
fn program_is_path(&self) -> bool
fn setup_io(&self, default: Stdio, needs_stdin: bool) -> Result<(StdioPipes, ChildPipes)>

impl Command

fn spawn(&mut self, default: Stdio, needs_stdin: bool) -> Result<(Process, StdioPipes)>
unsafe fn do_fork(&mut self) -> Result<pid_t, Error>
fn exec(&mut self, default: Stdio) -> Error
unsafe fn do_exec(&mut self, stdio: ChildPipes, maybe_envp: Option<&CStringArray>) -> Result<never, 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

impl Debug for Command

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Auto Trait Implementations

impl !RefUnwindSafe for Command

impl !UnwindSafe for Command

impl Freeze for Command

impl Send for Command

impl Sync for Command

impl Unpin for Command

impl UnsafeUnpin for Command

Blanket Implementations

impl<T> Any for Command where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Command where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Command where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for Command

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for Command where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for Command

impl<T, U> Into<U> for Command where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for Command where U: Into<T>,

type Error = Infallible;
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto<U> for Command where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>