Stop using (DY)LD_LIBRARY_PATH on Unix
This commit is contained in:
parent
a1e4ab3e38
commit
4b58071f96
3 changed files with 24 additions and 5 deletions
|
|
@ -131,7 +131,7 @@ fn worker(p: port<request>) {
|
|||
let spawnproc =
|
||||
bind run::spawn_process(execparms.prog, execparms.args,
|
||||
pipe_in.in, pipe_out.out, pipe_err.out);
|
||||
let pid = with_lib_path(execparms.lib_path, spawnproc);
|
||||
let pid = maybe_with_lib_path(execparms.lib_path, spawnproc);
|
||||
|
||||
os::libc::close(pipe_in.in);
|
||||
os::libc::close(pipe_out.out);
|
||||
|
|
@ -151,6 +151,18 @@ fn worker(p: port<request>) {
|
|||
}
|
||||
}
|
||||
|
||||
// Only windows needs to set the library path
|
||||
#[cfg(target_os = "win32")]
|
||||
fn maybe_with_lib_path<@T>(path: str, f: fn() -> T) -> T {
|
||||
with_lib_path(path, f)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
fn maybe_with_lib_path<@T>(_path: str, f: fn() -> T) -> T {
|
||||
f()
|
||||
}
|
||||
|
||||
fn with_lib_path<@T>(path: str, f: fn() -> T) -> T {
|
||||
let maybe_oldpath = getenv(util::lib_path_env_var());
|
||||
append_lib_path(path);
|
||||
|
|
|
|||
|
|
@ -310,6 +310,14 @@ fn program_output(cx: cx, testfile: str, lib_path: str, prog: str,
|
|||
cmdline: cmdline};
|
||||
}
|
||||
|
||||
// Linux and mac don't require adjusting the library search path
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
fn make_cmdline(_libpath: str, prog: str, args: [str]) -> str {
|
||||
#fmt["%s %s", prog, str::connect(args, " ")]
|
||||
}
|
||||
|
||||
#[cfg(target_os = "win32")]
|
||||
fn make_cmdline(libpath: str, prog: str, args: [str]) -> str {
|
||||
#fmt["%s %s %s", lib_path_cmd_prefix(libpath), prog,
|
||||
str::connect(args, " ")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue