Crates.io | environment |
lib.rs | environment |
version | 0.1.1 |
source | src |
created_at | 2017-10-12 11:36:05.311426 |
updated_at | 2017-10-12 11:49:01.894348 |
description | Helper to deal with environment variables. |
homepage | https://github.com/Freyskeyd/environment |
repository | https://github.com/Freyskeyd/environment.git |
max_upload_size | |
id | 35383 |
size | 9,955 |
Handle environment variable context - This crate helps you to deal with environment variables.
Just add it to your Cargo.toml
:
[dependencies]
environment = "0.1"
Here's a trivial example:
extern crate environment;
use std::process::Command;
fn main() {
let env = Environment::inherit().insert("foo", "bar");
let mut c = Command::new("printenv");
let output = c.env_clear()
.envs(env.compile())
.output()
.expect("failed to execute command");
let output = String::from_utf8_lossy(&output.stdout);
assert!(output.contains("foo=bar"));
}
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.