diff options
author | neumann <neumann> | 2023-07-07 13:30:19 (GMT) |
---|---|---|
committer | neumann <neumann> | 2023-07-07 13:30:19 (GMT) |
commit | 5452282a914145b2db5deb8cacc4f7c00413aab8 (patch) | |
tree | 83bd2a519c6d70510ea3855954be3eb351ad6572 | |
parent | a071f9c13b5242946d0c6cff069a3c08ef7c50e3 (diff) | |
download | tcl-5452282a914145b2db5deb8cacc4f7c00413aab8.zip tcl-5452282a914145b2db5deb8cacc4f7c00413aab8.tar.gz tcl-5452282a914145b2db5deb8cacc4f7c00413aab8.tar.bz2 |
- reduced error of posix_spawnp() cases for macOS to 1 (exec-17.1).
The problem seems related to a different I/O setup for cases,
when stdout is closed and to be replaced by a different stream
- deactivated posix_spawnp() for macOS for the time being
-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__ */ /* |