From 88b24aba8499997c8b3fe86e1109cfbfaafaf41f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurko=20Gospodneti=C4=87?= Date: Tue, 26 Jun 2012 19:44:47 +0000 Subject: [PATCH] Updated Boost Jam's child process output handling on Windows based on the -p command-line option to match the one used on Unix. If -p option value 0 is specified (the default), the child's stdout & stderr output streams are both collected into a single pipe and sent merged to the build process's stdout output. If any other -p option value is specified, the child's stdout & stderr output streams are collected separately and redirected based on the -p parameter value: 1 - stdout to stdout, stderr forgotten 2 - stdout forgotten, stderr to stderr 3 - stdout to stdout, stderr to stderr. [SVN r79123] --- src/engine/execnt.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/engine/execnt.c b/src/engine/execnt.c index c7c3b6537..3d2e65011 100644 --- a/src/engine/execnt.c +++ b/src/engine/execnt.c @@ -449,7 +449,7 @@ static void invoke_cmd( char const * const command, int const slot ) reportWindowsError( "CreatePipe" ); exit( EXITBAD ); } - if ( globs.pipe_action == 2 && !CreatePipe( &cmdtab[ slot ].pipe_err[ + if ( globs.pipe_action && !CreatePipe( &cmdtab[ slot ].pipe_err[ EXECCMD_PIPE_READ ], &cmdtab[ slot ].pipe_err[ EXECCMD_PIPE_WRITE ], &sa, 0 ) ) { @@ -460,7 +460,7 @@ static void invoke_cmd( char const * const command, int const slot ) /* Set handle inheritance off for the pipe ends the parent reads from. */ SetHandleInformation( cmdtab[ slot ].pipe_out[ EXECCMD_PIPE_READ ], HANDLE_FLAG_INHERIT, 0 ); - if ( globs.pipe_action == 2 ) + if ( globs.pipe_action ) SetHandleInformation( cmdtab[ slot ].pipe_err[ EXECCMD_PIPE_READ ], HANDLE_FLAG_INHERIT, 0 ); @@ -471,21 +471,9 @@ static void invoke_cmd( char const * const command, int const slot ) /* Redirect the child's output streams to our pipes. */ si.dwFlags |= STARTF_USESTDHANDLES; si.hStdOutput = cmdtab[ slot ].pipe_out[ EXECCMD_PIPE_WRITE ]; - if ( globs.pipe_action == 2 ) - { - /* Pipe stderr to the action error output. */ - si.hStdError = cmdtab[ slot ].pipe_err[ EXECCMD_PIPE_WRITE ]; - } - else if ( globs.pipe_action == 1 ) - { - /* Pipe stderr to the console error output. */ - si.hStdError = GetStdHandle( STD_ERROR_HANDLE ); - } - else - { - /* Pipe stderr to the action merged output. */ - si.hStdError = cmdtab[ slot ].pipe_out[ EXECCMD_PIPE_WRITE ]; - } + si.hStdError = globs.pipe_action + ? cmdtab[ slot ].pipe_err[ EXECCMD_PIPE_WRITE ] + : cmdtab[ slot ].pipe_out[ EXECCMD_PIPE_WRITE ]; /* Let the child inherit stdin, as some commands assume it is available. */ si.hStdInput = GetStdHandle( STD_INPUT_HANDLE );