File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
library/std/src/sys/unix/process Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -314,10 +314,20 @@ impl Command {
314314 ) -> libc:: c_int
315315 }
316316 let addchdir = match self . get_cwd ( ) {
317- Some ( cwd) => match posix_spawn_file_actions_addchdir_np. get ( ) {
318- Some ( f) => Some ( ( f, cwd) ) ,
319- None => return Ok ( None ) ,
320- } ,
317+ Some ( cwd) => {
318+ if cfg ! ( target_os = "macos" ) {
319+ // There is a bug in macOS where a relative executable
320+ // path like "../myprogram" will cause `posix_spawn` to
321+ // successfully launch the program, but erroneously return
322+ // ENOENT when used with posix_spawn_file_actions_addchdir_np
323+ // which was introduced in macOS 10.15.
324+ return Ok ( None ) ;
325+ }
326+ match posix_spawn_file_actions_addchdir_np. get ( ) {
327+ Some ( f) => Some ( ( f, cwd) ) ,
328+ None => return Ok ( None ) ,
329+ }
330+ }
321331 None => None ,
322332 } ;
323333
You can’t perform that action at this time.
0 commit comments