Skip to main content

CommandExt

Trait CommandExt 

Source
pub trait CommandExt {
    // Required methods
    fn from_script(_: &str) -> Self;
    fn with_arg<S: AsRef<OsStr>>(self, _: S) -> Self;
    fn with_args<I, S>(self, _: I) -> Self
       where I: IntoIterator<Item = S>,
             S: AsRef<OsStr>;
    fn display(&self) -> String;
    fn detach(&mut self) -> &mut Self;
    fn spawn_detached(&mut self) -> Option<Child>;
    fn spawn_piped(&mut self) -> Result<ChildStdout, StringError>;
    fn success(&mut self) -> bool;
    fn _exec(&mut self) -> !;
    fn _spawn(&mut self) -> Option<Child>;
}

Required Methods§

Source

fn from_script(_: &str) -> Self

Use SHELL to create a command from a shell script On unix, the empty string is given to $0 so that subsequent args are fed to the script directly. On windows (todo)

Source

fn with_arg<S: AsRef<OsStr>>(self, _: S) -> Self

Source

fn with_args<I, S>(self, _: I) -> Self
where I: IntoIterator<Item = S>, S: AsRef<OsStr>,

Source

fn display(&self) -> String

Display the command. Does not escape arguments.

Source

fn detach(&mut self) -> &mut Self

Detach the command. Does nothing on unsupported platforms (not windows or unix).

Source

fn spawn_detached(&mut self) -> Option<Child>

One-off spawn executable. Logs the command in debug builds. Prints error.

Source

fn spawn_piped(&mut self) -> Result<ChildStdout, StringError>

Spawn command with piped stdout. Debug logs the command.

Source

fn success(&mut self) -> bool

Naive check of whether a command succeeds. (i.e. health check).

Source

fn _exec(&mut self) -> !

Platform-agnostic exec the command.

Logs and displays errors.

Source

fn _spawn(&mut self) -> Option<Child>

Spawn the command, with trace and error logging.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl CommandExt for Command

Source§

fn from_script(script: &str) -> Self

Source§

fn with_arg<S: AsRef<OsStr>>(self, arg: S) -> Self

Source§

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

Source§

fn display(&self) -> String

Source§

fn detach(&mut self) -> &mut Self

Source§

fn spawn_detached(&mut self) -> Option<Child>

Source§

fn spawn_piped(&mut self) -> Result<ChildStdout, StringError>

Source§

fn success(&mut self) -> bool

Source§

fn _exec(&mut self) -> !

Source§

fn _spawn(&mut self) -> Option<Child>

Implementors§