#sub-processes #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

#9 in #subprocess

Download history 38/week @ 2025-10-09 55/week @ 2025-10-16 63/week @ 2025-10-23 55/week @ 2025-10-30 23/week @ 2025-11-06 15/week @ 2025-11-13 63/week @ 2025-11-20 29/week @ 2025-11-27 65/week @ 2025-12-04 90/week @ 2025-12-11 92/week @ 2025-12-18 40/week @ 2025-12-25 24/week @ 2026-01-01 12/week @ 2026-01-08 23/week @ 2026-01-15 35/week @ 2026-01-22

94 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