#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

#22 in #subprocess

Download history 9/week @ 2023-12-03 9/week @ 2023-12-10 67/week @ 2023-12-17 13/week @ 2023-12-24 23/week @ 2024-01-07 24/week @ 2024-01-14 32/week @ 2024-01-21 17/week @ 2024-01-28 94/week @ 2024-02-04 84/week @ 2024-02-11 29/week @ 2024-02-18 46/week @ 2024-02-25 30/week @ 2024-03-03 36/week @ 2024-03-10 52/week @ 2024-03-17

165 downloads per month
Used in 4 crates

MIT license

5KB
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