pub struct Command { /* private fields */ }
Implementations§
source§impl Command
impl Command
sourcepub fn new<A: AsUnixStr>(bin: A) -> Result<Self>
pub fn new<A: AsUnixStr>(bin: A) -> 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<A: AsUnixStr>(&mut self, env: A) -> Result<&mut Self>
pub fn env<A: AsUnixStr>(&mut self, env: A) -> Result<&mut Self>
Errors
If the string is not C string compatible
sourcepub fn envs<A: AsUnixStr>(&mut self, envs: Vec<A>) -> Result<&mut Self>
pub fn envs<A: AsUnixStr>(&mut self, envs: Vec<A>) -> Result<&mut Self>
Errors
If the string is not C string compatible
sourcepub fn arg<A: AsUnixStr>(&mut self, arg: A) -> Result<&mut Self>
pub fn arg<A: AsUnixStr>(&mut self, arg: A) -> Result<&mut Self>
Errors
If the string is not C string compatible
sourcepub fn args<A: AsUnixStr>(&mut self, args: &[A]) -> Result<&mut Self>
pub fn args<A: AsUnixStr>(&mut self, args: &[A]) -> Result<&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<A: AsUnixStr>(&mut self, dir: A) -> Result<&mut Self>
pub fn cwd<A: AsUnixStr>(&mut self, dir: A) -> Result<&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 !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