pub struct Command<'a> { /* private fields */ }
Implementations§
Source§impl<'a> Command<'a>
impl<'a> Command<'a>
Sourcepub fn new(bin: &'a UnixStr) -> Result<Self>
pub fn new(bin: &'a UnixStr) -> Result<Self>
Constructs a new command, setting the first argument as the binary’s name
§Errors
If the string is not C string compatible
Sourcepub fn env(&mut self, env: UnixString) -> &mut Self
pub fn env(&mut self, env: UnixString) -> &mut Self
§Errors
If the string is not C string compatible
Sourcepub fn envs(&mut self, envs: impl Iterator<Item = UnixString>) -> &mut Self
pub fn envs(&mut self, envs: impl Iterator<Item = UnixString>) -> &mut Self
§Errors
If the string is not C string compatible
Sourcepub fn arg(&mut self, arg: &'a UnixStr) -> &mut Self
pub fn arg(&mut self, arg: &'a UnixStr) -> &mut Self
§Errors
If the string is not C string compatible
Sourcepub fn args(&mut self, args: impl Iterator<Item = &'a UnixStr>) -> &mut Self
pub fn args(&mut self, args: impl Iterator<Item = &'a UnixStr>) -> &mut Self
§Errors
If the string is not C string compatible
Sourcepub unsafe fn pre_exec<F: FnMut() -> Result<()> + Send + Sync + 'static>(
&mut self,
f: F,
) -> &mut Self
pub unsafe fn pre_exec<F: FnMut() -> Result<()> + Send + Sync + 'static>( &mut self, f: F, ) -> &mut Self
A function to run after forking
off the process but before the exec call
§Safety
Some things, such as some memory access will immediately cause UB, keep it simple, short, and sweet.
Sourcepub fn cwd(&mut self, dir: &'a UnixStr) -> &mut Self
pub fn cwd(&mut self, dir: &'a UnixStr) -> &mut Self
§Errors
If the string is not C string compatible
pub fn uid(&mut self, id: UidT) -> &mut Self
pub fn gid(&mut self, id: GidT) -> &mut Self
pub fn pgroup(&mut self, pgroup: PidT) -> &mut Self
pub fn stdin(&mut self, stdin: Stdio) -> &mut Self
pub fn stdout(&mut self, stdout: Stdio) -> &mut Self
pub fn stderr(&mut self, stderr: Stdio) -> &mut Self
pub fn exec(&mut self) -> Error
Auto Trait Implementations§
impl<'a> Freeze for Command<'a>
impl<'a> !RefUnwindSafe for Command<'a>
impl<'a> Send for Command<'a>
impl<'a> Sync for Command<'a>
impl<'a> Unpin for Command<'a>
impl<'a> !UnwindSafe for Command<'a>
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