summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixPipe.c
diff options
context:
space:
mode:
authorneumann <neumann>2023-07-07 13:30:19 (GMT)
committerneumann <neumann>2023-07-07 13:30:19 (GMT)
commit5452282a914145b2db5deb8cacc4f7c00413aab8 (patch)
tree83bd2a519c6d70510ea3855954be3eb351ad6572 /unix/tclUnixPipe.c
parenta071f9c13b5242946d0c6cff069a3c08ef7c50e3 (diff)
downloadtcl-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
Diffstat (limited to 'unix/tclUnixPipe.c')
-rw-r--r--unix/tclUnixPipe.c6
1 files changed, 6 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