diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-03-31 11:34:17 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-03-31 15:54:44 -0700 |
| commit | 554946c81eeb4fcfceda782f6c5af394ab3fe8d3 (patch) | |
| tree | 26908e2779beed76296fbe7292bdf6af12dd46f7 /src/libstd/old_io/process.rs | |
| parent | e10ee2c8572421c056ea68e6656fee936e0330d8 (diff) | |
| parent | d4a2c941809f303b97d153e06ba07e95cd245f88 (diff) | |
| download | rust-554946c81eeb4fcfceda782f6c5af394ab3fe8d3.tar.gz rust-554946c81eeb4fcfceda782f6c5af394ab3fe8d3.zip | |
rollup merge of #23873: alexcrichton/remove-deprecated
Conflicts: src/libcollectionstest/fmt.rs src/libcollectionstest/lib.rs src/libcollectionstest/str.rs src/libcore/error.rs src/libstd/fs.rs src/libstd/io/cursor.rs src/libstd/os.rs src/libstd/process.rs src/libtest/lib.rs src/test/run-pass-fulldeps/compiler-calls.rs
Diffstat (limited to 'src/libstd/old_io/process.rs')
| -rw-r--r-- | src/libstd/old_io/process.rs | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/src/libstd/old_io/process.rs b/src/libstd/old_io/process.rs index 84d8fa31ba8..7e1865a9ed6 100644 --- a/src/libstd/old_io/process.rs +++ b/src/libstd/old_io/process.rs @@ -246,7 +246,7 @@ impl Command { None => { // if the env is currently just inheriting from the parent's, // materialize the parent's env into a hashtable. - self.env = Some(os::env_as_bytes().into_iter().map(|(k, v)| { + self.env = Some(::env::vars().map(|(k, v)| { (EnvKey(CString::new(k).unwrap()), CString::new(v).unwrap()) }).collect()); @@ -764,11 +764,9 @@ impl Drop for Process { #[cfg(test)] mod tests { + use prelude::v1::*; use old_io::{Truncate, Write, TimedOut, timer, process, FileNotFound}; use old_io::{Reader, Writer}; - use prelude::v1::{Ok, Err, drop, Some, None, Vec}; - use prelude::v1::{String, Clone}; - use prelude::v1::{Str, AsSlice, ToString}; use old_path::{GenericPath, Path}; use old_io::fs::PathExtensions; use old_io::timer::*; @@ -1003,7 +1001,7 @@ mod tests { let prog = pwd_cmd().spawn().unwrap(); let output = String::from_utf8(prog.wait_with_output().unwrap().output).unwrap(); - let parent_dir = os::getcwd().unwrap(); + let parent_dir = Path::new(::env::current_dir().unwrap().to_str().unwrap()); let child_dir = Path::new(output.trim()); let parent_stat = parent_dir.stat().unwrap(); @@ -1018,7 +1016,7 @@ mod tests { use os; // test changing to the parent of os::getcwd() because we know // the path exists (and os::getcwd() is not expected to be root) - let parent_dir = os::getcwd().unwrap().dir_path(); + let parent_dir = Path::new(::env::current_dir().unwrap().to_str().unwrap()); let prog = pwd_cmd().cwd(&parent_dir).spawn().unwrap(); let output = String::from_utf8(prog.wait_with_output().unwrap().output).unwrap(); @@ -1058,11 +1056,11 @@ mod tests { let prog = env_cmd().spawn().unwrap(); let output = String::from_utf8(prog.wait_with_output().unwrap().output).unwrap(); - let r = os::env(); - for &(ref k, ref v) in &r { + let r = ::env::vars(); + for (k, v) in r { // don't check windows magical empty-named variables assert!(k.is_empty() || - output.contains(&format!("{}={}", *k, *v)), + output.contains(&format!("{}={}", k, v)), "output doesn't contain `{}={}`\n{}", k, v, output); } @@ -1076,16 +1074,12 @@ mod tests { let mut prog = env_cmd().spawn().unwrap(); let output = String::from_utf8(prog.wait_with_output().unwrap().output).unwrap(); - let r = os::env(); - for &(ref k, ref v) in &r { + let r = env::vars(); + for (k, v) in r { // don't check android RANDOM variables - if *k != "RANDOM".to_string() { - assert!(output.contains(&format!("{}={}", - *k, - *v)) || - output.contains(&format!("{}=\'{}\'", - *k, - *v))); + if k != "RANDOM".to_string() { + assert!(output.contains(&format!("{}={}", k, v)) || + output.contains(&format!("{}=\'{}\'", k, v))); } } } @@ -1100,9 +1094,9 @@ mod tests { // PATH to our sub-process. let path_val: String; let mut new_env = vec![("RUN_TEST_NEW_ENV", "123")]; - match os::getenv("PATH") { - None => {} - Some(val) => { + match ::env::var("PATH") { + Err(..) => {} + Ok(val) => { path_val = val; new_env.push(("PATH", &path_val)) } |
