#process #subprocess #utility-trait

command-extra

Additional methods for std::process::Command

3 releases (1 stable)

1.0.0 Oct 14, 2020
0.1.0 Oct 14, 2020
0.0.0 Oct 14, 2020

#13 in #subprocess

Download history 7/week @ 2021-06-07 16/week @ 2021-06-14 9/week @ 2021-06-21 20/week @ 2021-06-28 27/week @ 2021-07-05 14/week @ 2021-07-12 155/week @ 2021-07-19 137/week @ 2021-07-26 55/week @ 2021-08-02 14/week @ 2021-08-09 41/week @ 2021-08-16 99/week @ 2021-08-23 81/week @ 2021-08-30 56/week @ 2021-09-06 52/week @ 2021-09-13 11/week @ 2021-09-20

164 downloads per month
Used in 2 crates

MIT license

4KB
56 lines

Command Extra

Test Travis Build Status Crates.io Version Documentation

Additional methods for std::process::Command.

Motivation

Default Command mutation methods take a mutable reference and return a mutable reference, making sharing code verbose:

fn shared_command() -> Command {
    let mut command = Command::new("command");
    command
        .current_dir("work-dir")
        .env("FOO", "foo")
        .arg("bar");
    command
}

With CommandExtra, the above code can be shorter:

fn shared_command() -> Command {
    Command::new("command")
        .with_current_dir("work-dir")
        .with_env("FOO", "foo")
        .with_arg("bar")
}

License

MIT © Hoàng Văn Khải

No runtime deps