29 releases

0.2.2 May 3, 2022
0.2.1 Jan 2, 2022
0.2.0 Sep 24, 2021
0.1.0 Sep 12, 2021
0.0.8 Jun 30, 2021

#454 in Operating systems

Download history 75/week @ 2024-07-22 63/week @ 2024-07-29 46/week @ 2024-08-05 37/week @ 2024-08-12 40/week @ 2024-08-19 63/week @ 2024-08-26 25/week @ 2024-09-02 21/week @ 2024-09-09 25/week @ 2024-09-16 41/week @ 2024-09-23 42/week @ 2024-09-30 35/week @ 2024-10-07 42/week @ 2024-10-14 17/week @ 2024-10-21 19/week @ 2024-10-28 38/week @ 2024-11-04

120 downloads per month
Used in 4 crates (3 directly)

CC0 license

115KB
2.5K SLoC

ci status badge crates.io docs

cradle is a library for executing child processes. It provides a more convenient interface than std::process::Command. Here's an example:

use cradle::prelude::*;

fn main() {
    // output git version
    run!(%"git --version");
    // output configured git user
    let (StdoutTrimmed(git_user), Status(status)) = run_output!(%"git config --get user.name");
    if status.success() {
        eprintln!("git user: {}", git_user);
    } else {
        eprintln!("git user not configured");
    }
}

For comprehensive documentation, head over to docs.rs/cradle.

Design Goals

cradle is meant to make it as easy as possible to run child processes, while making it hard to use incorrectly. As such it provides an interface that is concise and flexible, and tries to avoid surprising behavior.

cradle does not try to emulate the syntax or functionality of bash or other shells, such as pipes (|), globs (*), or other string expansion. Instead, it aims to be a convenient wrapper around the operating system's interface for running child processes.

MSRV

The minimal supported rust version is 0.41.

Dependencies

~0–8.5MB
~85K SLoC