pub struct Command {Show 17 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,
}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: boolAvailable on Linux only.
§pgroup: Option<pid_t>§setsid: boolImplementations§
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 chroot(&mut self, dir: &Path)
pub fn setsid(&mut self, setsid: bool)
pub fn create_pidfd(&mut self, val: bool)
Available on Linux only.
pub fn get_create_pidfd(&self) -> bool
Available on Linux only.
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_env_clear(&self) -> bool
pub fn get_resolved_envs(&self) -> CommandResolvedEnvs ⓘ
pub fn get_current_dir(&self) -> Option<&Path>
pub fn get_argv(&self) -> &CStringArray
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_chroot(&self) -> Option<&CStr>
pub fn get_setsid(&self) -> bool
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>
Available on neither QNX SDP 7.x nor QNX SDP 8.0+ nor tvOS nor watchOS.
pub fn exec(&mut self, default: Stdio) -> Error
unsafe fn do_exec( &mut self, stdio: ChildPipes, maybe_envp: Option<&CStringArray>, ) -> Result<!, Error>
Available on neither tvOS nor watchOS.
fn posix_spawn( &mut self, stdio: &ChildPipes, envp: Option<&CStringArray>, ) -> Result<Option<Process>>
Available on Apple, or Cygwin, or FreeBSD, or illumos, or QNX SDP 7.x, or QNX SDP 8.0+, or GNU and Linux, or Linux and musl only.
fn send_pidfd(&self, sock: &Socket)
Available on Linux only.
fn recv_pidfd(&self, sock: &Socket) -> pid_t
Available on Linux only.
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 !RefUnwindSafe for Command
impl !UnwindSafe for Command
impl Forget for Command
impl Freeze for Commandwhere
*const [u8] is !null: Freeze,
PhantomData<[u8]>: Freeze,
*const u8 is !null: Freeze,
PhantomData<*const i8>: Freeze,
*const LeafNode<OsString, Option<OsString>> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(OsString, Option<OsString>)>>: Freeze,
PhantomData<Box<dyn FnMut() -> Result<(), Error> + Send + Sync>>: Freeze,
*const [u32] is !null: Freeze,
PhantomData<[u32]>: Freeze,
I32NotAllOnes: Freeze,
PhantomData<&'static OwnedFd>: Freeze,
impl Move for Command
impl Send for Commandwhere
BoxRaw<[u8]>: Send,
CStringArray: Send,
NodeRef<Owned, OsString, Option<OsString>, LeafOrInternal>: Send,
BoxRaw<(OsString, Option<OsString>)>: Send,
RawVecInner: Send,
BoxRaw<dyn FnMut() -> Result<(), Error> + Send + Sync>: Send,
BoxRaw<[u32]>: Send,
I32NotAllOnes: Send,
&'static OwnedFd: Send,
impl Sync for Command
impl Unpin for Command
impl UnsafeUnpin for Commandwhere
*const [u8] is !null: UnsafeUnpin,
PhantomData<[u8]>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<*const i8>: UnsafeUnpin,
*const LeafNode<OsString, Option<OsString>> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(OsString, Option<OsString>)>>: UnsafeUnpin,
PhantomData<Box<dyn FnMut() -> Result<(), Error> + Send + Sync>>: UnsafeUnpin,
*const [u32] is !null: UnsafeUnpin,
PhantomData<[u32]>: UnsafeUnpin,
I32NotAllOnes: UnsafeUnpin,
PhantomData<&'static OwnedFd>: UnsafeUnpin,
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> SizeHint for Twhere
T: ?Sized,
impl<T> SizeHint for Twhere
T: ?Sized,
Source§default fn lower_bound(&self) -> usize
default fn lower_bound(&self) -> usize
🔬This is a nightly-only experimental API. (
core_io_internals)Returns a lower bound on the number of elements this container-like item
contains.
For example, an array
[u8; 12] could return any value between 0 and
12 inclusively as a correct implementation. Read moreSource§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)]const SIZE: usize
#[doc(hidden)]const SIZE: usize
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const ALIGN: usize
#[doc(hidden)]const ALIGN: usize
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const ALIGNMENT: Alignment
#[doc(hidden)]const ALIGNMENT: Alignment
🔬This is a nightly-only experimental API. (
sized_type_properties)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