2 releases
Uses old Rust 2015
0.1.1 | Oct 12, 2017 |
---|---|
0.1.0 | Oct 12, 2017 |
#858 in Configuration
1,658 downloads per month
Used in 42 crates
(via assert_cli)
9KB
149 lines
Environment
Handle environment variable context - This crate helps you to deal with environment variables.
Install
Just add it to your Cargo.toml
:
[dependencies]
environment = "0.1"
Example
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"));
}
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
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.