mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-26 14:43:24 +00:00
Don't use posix_spawn_file_actions_addchdir_np on macOS.
This commit is contained in:
parent
7d3818152d
commit
a938725ef7
@ -314,10 +314,20 @@ impl Command {
|
||||
) -> libc::c_int
|
||||
}
|
||||
let addchdir = match self.get_cwd() {
|
||||
Some(cwd) => match posix_spawn_file_actions_addchdir_np.get() {
|
||||
Some(f) => Some((f, cwd)),
|
||||
None => return Ok(None),
|
||||
},
|
||||
Some(cwd) => {
|
||||
if cfg!(target_os = "macos") {
|
||||
// There is a bug in macOS where a relative executable
|
||||
// path like "../myprogram" will cause `posix_spawn` to
|
||||
// successfully launch the program, but erroneously return
|
||||
// ENOENT when used with posix_spawn_file_actions_addchdir_np
|
||||
// which was introduced in macOS 10.15.
|
||||
return Ok(None);
|
||||
}
|
||||
match posix_spawn_file_actions_addchdir_np.get() {
|
||||
Some(f) => Some((f, cwd)),
|
||||
None => return Ok(None),
|
||||
}
|
||||
}
|
||||
None => None,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user