https://github.com/soenkehahn/cradle
Rust library for running child processes
https://github.com/soenkehahn/cradle
rust
Last synced: 9 months ago
JSON representation
Rust library for running child processes
- Host: GitHub
- URL: https://github.com/soenkehahn/cradle
- Owner: soenkehahn
- License: cc0-1.0
- Created: 2021-04-30T17:37:09.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-06-27T22:05:19.000Z (about 1 year ago)
- Last Synced: 2025-09-19T16:09:41.153Z (10 months ago)
- Topics: rust
- Language: Rust
- Homepage:
- Size: 184 KB
- Stars: 38
- Watchers: 3
- Forks: 5
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/soenkehahn/cradle/actions?query=branch%3Amain)
[](https://crates.io/crates/cradle)
[](https://docs.rs/cradle)
`cradle` is a library for executing child processes.
It provides a more convenient interface than
[std::process::Command](https://doc.rust-lang.org/std/process/struct.Command.html).
Here's an example:
``` rust
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](https://docs.rs/cradle/latest/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`.