diff options
| author | Chris Denton <chris@chrisdenton.dev> | 2025-04-22 15:24:05 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-22 15:24:05 +0000 |
| commit | 1586660fb270fcf32a77521b7348ac138c99c489 (patch) | |
| tree | 194a9ac68d195482a8ce18532c247b4860a0cde7 | |
| parent | 6bc57c6bf7d0024ad9ea5a2c112f3fc9c383c8a4 (diff) | |
| parent | 7aab011dbb6ab2a46c12107d8a516b10a961f2a2 (diff) | |
| download | rust-1586660fb270fcf32a77521b7348ac138c99c489.tar.gz rust-1586660fb270fcf32a77521b7348ac138c99c489.zip | |
Rollup merge of #139617 - Berrysoft:cygwin-posix-spawn, r=joboet
Use posix_spawn on cygwin r? ``@joboet`` Depends on: - [x] https://github.com/rust-lang/libc/pull/4387 - [x] https://github.com/rust-lang/rust/pull/140081
| -rw-r--r-- | library/std/src/sys/process/unix/unix.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/library/std/src/sys/process/unix/unix.rs b/library/std/src/sys/process/unix/unix.rs index 3b04ec50db3..92bb809d90c 100644 --- a/library/std/src/sys/process/unix/unix.rs +++ b/library/std/src/sys/process/unix/unix.rs @@ -415,6 +415,7 @@ impl Command { all(target_os = "linux", target_env = "musl"), target_os = "nto", target_vendor = "apple", + target_os = "cygwin", )))] fn posix_spawn( &mut self, @@ -433,6 +434,7 @@ impl Command { all(target_os = "linux", target_env = "musl"), target_os = "nto", target_vendor = "apple", + target_os = "cygwin", ))] fn posix_spawn( &mut self, @@ -584,7 +586,7 @@ impl Command { /// Some platforms can set a new working directory for a spawned process in the /// `posix_spawn` path. This function looks up the function pointer for adding /// such an action to a `posix_spawn_file_actions_t` struct. - #[cfg(not(all(target_os = "linux", target_env = "musl")))] + #[cfg(not(any(all(target_os = "linux", target_env = "musl"), target_os = "cygwin")))] fn get_posix_spawn_addchdir() -> Option<PosixSpawnAddChdirFn> { use crate::sys::weak::weak; @@ -618,7 +620,9 @@ impl Command { /// Weak symbol lookup doesn't work with statically linked libcs, so in cases /// where static linking is possible we need to either check for the presence /// of the symbol at compile time or know about it upfront. - #[cfg(all(target_os = "linux", target_env = "musl"))] + /// + /// Cygwin doesn't support weak symbol, so just link it. + #[cfg(any(all(target_os = "linux", target_env = "musl"), target_os = "cygwin"))] fn get_posix_spawn_addchdir() -> Option<PosixSpawnAddChdirFn> { // Our minimum required musl supports this function, so we can just use it. Some(libc::posix_spawn_file_actions_addchdir_np) |
