Skip to content

Commit c74efdd

Browse files
committed
Fixes:
* give the new feature its own feature tag * correct a lifetime problem in the test * use .output() instead of .spawn() in the test so that output is actually collected * correct the same error in the test whose skeleton I cribbed
1 parent 55a6fdb commit c74efdd

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

src/libstd/process.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ impl Command {
399399
/// .spawn()
400400
/// .expect("printenv failed to start");
401401
/// ```
402-
#[stable(feature = "process", since = "1.16.0")]
402+
#[stable(feature = "command_envs", since = "1.16.0")]
403403
pub fn envs<K, V>(&mut self, vars: &[(K, V)]) -> &mut Command
404404
where K: AsRef<OsStr>, V: AsRef<OsStr>
405405
{

src/test/run-pass/process-envs.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,17 @@ fn main() {
4141
let filtered_env : Vec<(String, String)> =
4242
env::vars().filter(|&(ref k, _)| k == "PATH").collect();
4343

44-
let mut cmd = env_cmd()
45-
.env_clear()
46-
.envs(&filtered_env);
44+
let mut cmd = env_cmd();
45+
cmd.env_clear();
46+
cmd.envs(&filtered_env);
4747

4848
// restore original environment
4949
match old_env {
5050
None => env::remove_var("RUN_TEST_NEW_ENV"),
5151
Some(val) => env::set_var("RUN_TEST_NEW_ENV", &val)
5252
}
5353

54-
let prog = cmd.spawn().unwrap();
55-
let result = prog.wait_with_output().unwrap();
54+
let result = cmd.output().unwrap();
5655
let output = String::from_utf8_lossy(&result.stdout);
5756

5857
assert!(!output.contains("RUN_TEST_NEW_ENV"),

src/test/run-pass/process-remove-from-env.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ fn main() {
4646
Some(val) => env::set_var("RUN_TEST_NEW_ENV", &val)
4747
}
4848

49-
let prog = cmd.spawn().unwrap();
50-
let result = prog.wait_with_output().unwrap();
49+
let result = cmd.output().unwrap();
5150
let output = String::from_utf8_lossy(&result.stdout);
5251

5352
assert!(!output.contains("RUN_TEST_NEW_ENV"),

0 commit comments

Comments
 (0)