Fix posix_spawn not being used on iOS and visionOS

`man posix_spawn` documents it to be able to return `ENOENT`, and there
should be nothing preventing this. Tested in the iOS simulator and on
Mac Catalyst.
This commit is contained in:
Mads Marquart 2024-04-28 22:34:51 +02:00
parent 6b488cd302
commit f9f3573b62

View File

@ -420,13 +420,11 @@ impl Command {
}
#[cfg(not(any(
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
target_os = "freebsd",
all(target_os = "linux", target_env = "gnu"),
all(target_os = "linux", target_env = "musl"),
target_os = "nto",
target_vendor = "apple",
)))]
fn posix_spawn(
&mut self,
@ -439,14 +437,11 @@ impl Command {
// Only support platforms for which posix_spawn() can return ENOENT
// directly.
#[cfg(any(
target_os = "macos",
// FIXME: `target_os = "ios"`?
target_os = "tvos",
target_os = "watchos",
target_os = "freebsd",
all(target_os = "linux", target_env = "gnu"),
all(target_os = "linux", target_env = "musl"),
target_os = "nto",
target_vendor = "apple",
))]
fn posix_spawn(
&mut self,
@ -530,7 +525,7 @@ impl Command {
}
let addchdir = match self.get_cwd() {
Some(cwd) => {
if cfg!(any(target_os = "macos", target_os = "tvos", target_os = "watchos")) {
if cfg!(target_vendor = "apple") {
// 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