mirror of
https://salsa.debian.org/srivasta/make-dfsg.git
synced 2025-02-07 13:03:08 +00:00
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.
This commit is contained in:
parent
0a3a0756b9
commit
86a058029b
2 changed files with 14 additions and 10 deletions
|
@ -1454,7 +1454,7 @@ int shell_function_pid = 0, shell_function_completed;
|
||||||
|
|
||||||
|
|
||||||
int
|
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;
|
SECURITY_ATTRIBUTES saAttr;
|
||||||
HANDLE hIn = INVALID_HANDLE_VALUE;
|
HANDLE hIn = INVALID_HANDLE_VALUE;
|
||||||
|
@ -1500,7 +1500,7 @@ windows32_openpipe (int *pipedes, pid_t *pid_p, char **command_argv, char **envp
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tmpErr = GetStdHandle (STD_ERROR_HANDLE);
|
tmpErr = (HANDLE)_get_osfhandle (errfd);
|
||||||
if (DuplicateHandle (GetCurrentProcess (), tmpErr,
|
if (DuplicateHandle (GetCurrentProcess (), tmpErr,
|
||||||
GetCurrentProcess (), &hErr,
|
GetCurrentProcess (), &hErr,
|
||||||
0, TRUE, DUPLICATE_SAME_ACCESS) == FALSE)
|
0, TRUE, DUPLICATE_SAME_ACCESS) == FALSE)
|
||||||
|
@ -1729,7 +1729,7 @@ func_shell_base (char *o, char **argv, int trim_newlines)
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
#elif defined(WINDOWS32)
|
#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. */
|
/* Restore the value of just_print_flag. */
|
||||||
just_print_flag = j_p_f;
|
just_print_flag = j_p_f;
|
||||||
|
|
||||||
|
|
18
job.c
18
job.c
|
@ -1639,14 +1639,18 @@ start_job_command (struct child *child)
|
||||||
sync_Path_environment ();
|
sync_Path_environment ();
|
||||||
|
|
||||||
#ifndef NO_OUTPUT_SYNC
|
#ifndef NO_OUTPUT_SYNC
|
||||||
/* Divert child output if output_sync in use. Don't capture
|
/* Divert child output if output_sync in use. */
|
||||||
recursive make output unless we are synchronizing "make" mode. */
|
if (child->output.syncout)
|
||||||
if (child->output.syncout)
|
{
|
||||||
hPID = process_easy (argv, child->environment,
|
if (child->output.out >= 0)
|
||||||
child->output.out, child->output.err);
|
outfd = child->output.out;
|
||||||
else
|
if (child->output.err >= 0)
|
||||||
|
errfd = child->output.err;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
outfd = errfd = -1;
|
||||||
#endif
|
#endif
|
||||||
hPID = process_easy (argv, child->environment, -1, -1);
|
hPID = process_easy (argv, child->environment, outfd, errfd);
|
||||||
|
|
||||||
if (hPID != INVALID_HANDLE_VALUE)
|
if (hPID != INVALID_HANDLE_VALUE)
|
||||||
child->pid = (pid_t) hPID;
|
child->pid = (pid_t) hPID;
|
||||||
|
|
Loading…
Reference in a new issue