]> git.proxmox.com Git - rustc.git/blobdiff - src/compiletest/procsrv.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / compiletest / procsrv.rs
index 7c5397a1af989d474c2cd4994d1e57ce61b2af84..f418edf66866e83f0c97d3af8fcc367484c01b33 100644 (file)
@@ -8,9 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(deprecated)]
-
-use std::dynamic_lib::DynamicLibrary;
+use std::env;
+use std::ffi::OsString;
 use std::io::prelude::*;
 use std::path::PathBuf;
 use std::process::{ExitStatus, Command, Child, Output, Stdio};
@@ -18,15 +17,22 @@ use std::process::{ExitStatus, Command, Child, Output, Stdio};
 fn add_target_env(cmd: &mut Command, lib_path: &str, aux_path: Option<&str>) {
     // Need to be sure to put both the lib_path and the aux path in the dylib
     // search path for the child.
-    let mut path = DynamicLibrary::search_path();
+    let var = if cfg!(windows) {
+        "PATH"
+    } else if cfg!(target_os = "macos") {
+        "DYLD_LIBRARY_PATH"
+    } else {
+        "LD_LIBRARY_PATH"
+    };
+    let mut path = env::split_paths(&env::var_os(var).unwrap_or(OsString::new()))
+                       .collect::<Vec<_>>();
     if let Some(p) = aux_path {
         path.insert(0, PathBuf::from(p))
     }
     path.insert(0, PathBuf::from(lib_path));
 
     // Add the new dylib search path var
-    let var = DynamicLibrary::envvar();
-    let newpath = DynamicLibrary::create_path(&path);
+    let newpath = env::join_paths(&path).unwrap();
     cmd.env(var, newpath);
 }