Skip to main content

DtactCommand

Struct DtactCommand 

Source
pub struct DtactCommand(/* private fields */);
Expand description

Async-friendly wrapper over std::process::Command. Builder methods mirror std::process::Command’s own naming.

Implementations§

Source§

impl DtactCommand

Source

pub fn new(program: impl AsRef<OsStr>) -> Self

Start building a command that will run program.

Source

pub fn arg(&mut self, arg: impl AsRef<OsStr>) -> &mut Self

Append a single argument.

Source

pub fn args<I, S>(&mut self, args: I) -> &mut Self
where I: IntoIterator<Item = S>, S: AsRef<OsStr>,

Append multiple arguments at once.

Source

pub fn env( &mut self, key: impl AsRef<OsStr>, val: impl AsRef<OsStr>, ) -> &mut Self

Set an environment variable for the child process.

Source

pub fn current_dir(&mut self, dir: impl AsRef<Path>) -> &mut Self

Set the working directory the child process is spawned in.

Source

pub fn stdin(&mut self, cfg: Stdio) -> &mut Self

Configure how the child’s stdin is set up (inherit/pipe/null).

Source

pub fn stdout(&mut self, cfg: Stdio) -> &mut Self

Configure how the child’s stdout is set up (inherit/pipe/null).

Source

pub fn stderr(&mut self, cfg: Stdio) -> &mut Self

Configure how the child’s stderr is set up (inherit/pipe/null).

Source

pub fn spawn(&mut self) -> Result<DtactChild>

Spawn the child process. A direct synchronous syscall — see the module doc for why this isn’t dispatched to the pool.

§Errors

Returns whatever std::process::Command::spawn returns: most commonly io::ErrorKind::NotFound if program isn’t on PATH/ doesn’t exist, or PermissionDenied if it exists but isn’t executable by the current user.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.