summaryrefslogtreecommitdiff
path: root/function.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2014-10-01 18:26:28 +0300
committerEli Zaretskii <eliz@gnu.org>2014-10-01 18:26:28 +0300
commit86a058029beb8c5516eed4293de2a8b9131f3438 (patch)
treef4ff15f06cdbb0eb4439b863b07f0eced1444cae /function.c
parent0a3a0756b987e2f7f06322de746c3da5fef4c9ed (diff)
downloadgunmake-86a058029beb8c5516eed4293de2a8b9131f3438.tar.gz
Treat redirection of standard handles on Windows as it is done on Unix.
* job.c (start_job_command) [WINDOWS32]: Compute outfd and errfd as on Posix platforms, and pass the results to process_easy. * function.c (windows32_openpipe) [WINDOWS32]: Accept an additional argument ERRFD and use it for redirecting the standard error handle passed to the subprocess. (func_shell_base) [WINDOWS32]: Pass the computed errfd to windows32_openpipe.
Diffstat (limited to 'function.c')
-rw-r--r--function.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/function.c b/function.c
index 9bb0623..169c3a1 100644
--- a/function.c
+++ b/function.c
@@ -1454,7 +1454,7 @@ int shell_function_pid = 0, shell_function_completed;
int
-windows32_openpipe (int *pipedes, pid_t *pid_p, char **command_argv, char **envp)
+windows32_openpipe (int *pipedes, int errfd, pid_t *pid_p, char **command_argv, char **envp)
{
SECURITY_ATTRIBUTES saAttr;
HANDLE hIn = INVALID_HANDLE_VALUE;
@@ -1500,7 +1500,7 @@ windows32_openpipe (int *pipedes, pid_t *pid_p, char **command_argv, char **envp
return -1;
}
}
- tmpErr = GetStdHandle (STD_ERROR_HANDLE);
+ tmpErr = (HANDLE)_get_osfhandle (errfd);
if (DuplicateHandle (GetCurrentProcess (), tmpErr,
GetCurrentProcess (), &hErr,
0, TRUE, DUPLICATE_SAME_ACCESS) == FALSE)
@@ -1729,7 +1729,7 @@ func_shell_base (char *o, char **argv, int trim_newlines)
return o;
}
#elif defined(WINDOWS32)
- windows32_openpipe (pipedes, &pid, command_argv, envp);
+ windows32_openpipe (pipedes, errfd, &pid, command_argv, envp);
/* Restore the value of just_print_flag. */
just_print_flag = j_p_f;