@@ -415,6 +415,7 @@ impl Command {
415415 all( target_os = "linux" , target_env = "musl" ) ,
416416 target_os = "nto" ,
417417 target_vendor = "apple" ,
418+ target_os = "cygwin" ,
418419 ) ) ) ]
419420 fn posix_spawn (
420421 & mut self ,
@@ -433,6 +434,7 @@ impl Command {
433434 all( target_os = "linux" , target_env = "musl" ) ,
434435 target_os = "nto" ,
435436 target_vendor = "apple" ,
437+ target_os = "cygwin" ,
436438 ) ) ]
437439 // FIXME(#115199): Rust currently omits weak function definitions
438440 // and its metadata from LLVM IR.
@@ -587,7 +589,7 @@ impl Command {
587589 /// Some platforms can set a new working directory for a spawned process in the
588590 /// `posix_spawn` path. This function looks up the function pointer for adding
589591 /// such an action to a `posix_spawn_file_actions_t` struct.
590- #[ cfg( not( all( target_os = "linux" , target_env = "musl" ) ) ) ]
592+ #[ cfg( not( any ( all( target_os = "linux" , target_env = "musl" ) , target_os = "cygwin ") ) ) ]
591593 fn get_posix_spawn_addchdir ( ) -> Option < PosixSpawnAddChdirFn > {
592594 use crate :: sys:: weak:: weak;
593595
@@ -621,7 +623,9 @@ impl Command {
621623 /// Weak symbol lookup doesn't work with statically linked libcs, so in cases
622624 /// where static linking is possible we need to either check for the presence
623625 /// of the symbol at compile time or know about it upfront.
624- #[ cfg( all( target_os = "linux" , target_env = "musl" ) ) ]
626+ ///
627+ /// Cygwin doesn't support weak symbol, so just link it.
628+ #[ cfg( any( all( target_os = "linux" , target_env = "musl" ) , target_os = "cygwin" ) ) ]
625629 fn get_posix_spawn_addchdir ( ) -> Option < PosixSpawnAddChdirFn > {
626630 // Our minimum required musl supports this function, so we can just use it.
627631 Some ( libc:: posix_spawn_file_actions_addchdir_np)
0 commit comments