diff options
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tclUnixPipe.c | 6 | ||||
-rw-r--r-- | unix/tclUnixPort.h | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c index acc3b40..649fa4d 100644 --- a/unix/tclUnixPipe.c +++ b/unix/tclUnixPipe.c @@ -415,6 +415,9 @@ TclpCreateProcess( Tcl_DString *dsArray; char **newArgv; int pid, i; +#if defined(HAVE_POSIX_SPAWNP) + int childErrno; +#endif errPipeIn = NULL; errPipeOut = NULL; @@ -478,11 +481,13 @@ TclpCreateProcess( 0 # endif ); + posix_spawn_file_actions_adddup2(&actions, GetFd(inputFile), 0); posix_spawn_file_actions_adddup2(&actions, GetFd(outputFile), 1); posix_spawn_file_actions_adddup2(&actions, GetFd(errorFile), 2); status = posix_spawnp(&pid, newArgv[0], &actions, &attr, newArgv, environ); + childErrno = status; posix_spawn_file_actions_destroy(&actions); posix_spawnattr_destroy(&attr); @@ -552,6 +557,7 @@ TclpCreateProcess( if (pid == -1) { #ifdef HAVE_POSIX_SPAWNP + errno = childErrno; Tcl_SetObjResult(interp, Tcl_ObjPrintf( "couldn't execute \"%s\": %s", argv[0], Tcl_PosixError(interp))); #else diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index c2115df..cf0e548 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -636,6 +636,13 @@ extern char ** environ; defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1050 # warning "Weak import of 64-bit CoreFoundation is not supported, will not run on Mac OS X < 10.5." # endif +/* For now, test exec-17.1 fails (I/O setup after closing stdout) with + * posix_spawnp(), but the classic implementation (based on fork()+execvp()) + * works well under macOS quite OK. + */ +# if defined(HAVE_POSIX_SPAWNP) +# undef HAVE_POSIX_SPAWNP +# endif /* __x86_64__ */ #endif /* __APPLE__ */ /* |