Crates.io | shells |
lib.rs | shells |
version | 0.2.0 |
source | src |
created_at | 2016-03-15 02:05:03.309251 |
updated_at | 2016-04-06 23:50:57.674094 |
description | Sugar-coating for invoking shell commands directly from Rust. |
homepage | https://github.com/Proksima/shells |
repository | https://github.com/Proksima/shells |
max_upload_size | |
id | 4453 |
size | 11,452 |
Wrapper around std::process::Command which make the use of Rust for shell scripting more appealing.
http://proksima.github.io/shells-doc/shells/index.html
#[macro_use]
extern crate shells;
fn main() {
let (code, stdout, stderr) = sh!("echo '{} + {}' | bc", 1, 3);
assert_eq!(code, 0);
assert_eq!(&stdout[..], "4\n");
assert_eq!(&stderr[..], "");
}
A mnemotechnic to remember the ordering of the elements in the resulting tuple is the positions of stdout and stderr, they correspond to the standard streams numbers: 1 and 2 respectively.
If I a missing your favorite (at least partially) POSIX-compliant shell, submit a pull request!