about summary refs log tree commit diff
path: root/src/libstd/sys/windows/process.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-03-30 11:00:05 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-03-31 15:49:57 -0700
commitd4a2c941809f303b97d153e06ba07e95cd245f88 (patch)
treef876f056ff60aeac3f0098deb2dbe1fabfd13091 /src/libstd/sys/windows/process.rs
parentd754722a04b99fdcae0fd97fa2a4395521145ef2 (diff)
downloadrust-d4a2c941809f303b97d153e06ba07e95cd245f88.tar.gz
rust-d4a2c941809f303b97d153e06ba07e95cd245f88.zip
std: Clean out #[deprecated] APIs
This commit cleans out a large amount of deprecated APIs from the standard
library and some of the facade crates as well, updating all users in the
compiler and in tests as it goes along.
Diffstat (limited to 'src/libstd/sys/windows/process.rs')
-rw-r--r--src/libstd/sys/windows/process.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs
index 297f6e173ab..2065df4fbe3 100644
--- a/src/libstd/sys/windows/process.rs
+++ b/src/libstd/sys/windows/process.rs
@@ -23,6 +23,7 @@ use mem;
 use old_io::process::{ProcessExit, ExitStatus};
 use old_io::{IoResult, IoError};
 use old_io;
+use fs::PathExt;
 use os;
 use old_path::{BytesContainer, GenericPath};
 use ptr;
@@ -142,14 +143,19 @@ impl Process {
         let program = cfg.env().and_then(|env| {
             for (key, v) in env {
                 if b"PATH" != key.container_as_bytes() { continue }
+                let v = match ::str::from_utf8(v.container_as_bytes()) {
+                    Ok(s) => s,
+                    Err(..) => continue,
+                };
 
                 // Split the value and test each path to see if the
                 // program exists.
-                for path in os::split_paths(v.container_as_bytes()) {
-                    let path = path.join(cfg.program().as_bytes())
+                for path in ::env::split_paths(v) {
+                    let program = str::from_utf8(cfg.program().as_bytes()).unwrap();
+                    let path = path.join(program)
                                    .with_extension(env::consts::EXE_EXTENSION);
                     if path.exists() {
-                        return Some(CString::from_slice(path.as_vec()))
+                        return Some(CString::new(path.to_str().unwrap()).unwrap())
                     }
                 }
                 break
@@ -482,9 +488,9 @@ mod tests {
     #[test]
     fn test_make_command_line() {
         fn test_wrapper(prog: &str, args: &[&str]) -> String {
-            make_command_line(&CString::from_slice(prog.as_bytes()),
+            make_command_line(&CString::new(prog),
                               &args.iter()
-                                   .map(|a| CString::from_slice(a.as_bytes()))
+                                   .map(|a| CString::new(a))
                                    .collect::<Vec<CString>>())
         }