summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-05-08 13:41:18 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-05-08 13:41:18 (GMT)
commit06d0cd53f2c0c1baa274626101d053a9078c83a0 (patch)
tree45eb32480c5ab7fbbbcf2075fc11be6d6158a112 /Source
parentee15acd8273d49672745aa988819ff8c564e94bc (diff)
parentf65bb82f3688ba33faccf2ef0690571e1aa6edc2 (diff)
downloadCMake-06d0cd53f2c0c1baa274626101d053a9078c83a0.zip
CMake-06d0cd53f2c0c1baa274626101d053a9078c83a0.tar.gz
CMake-06d0cd53f2c0c1baa274626101d053a9078c83a0.tar.bz2
Merge topic 'execute_process-merge-output'
f65bb82f execute_process: Improve stdout/stderr merging
Diffstat (limited to 'Source')
-rw-r--r--Source/cmExecuteProcessCommand.cxx24
1 files changed, 19 insertions, 5 deletions
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index 1225992..a371390 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -255,7 +255,7 @@ bool cmExecuteProcessCommand
cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1);
// Check the output variables.
- bool merge_output = (output_variable == error_variable);
+ bool merge_output = false;
if(!input_file.empty())
{
cmsysProcess_SetPipeFile(cp, cmsysProcess_Pipe_STDIN, input_file.c_str());
@@ -267,8 +267,23 @@ bool cmExecuteProcessCommand
}
if(!error_file.empty())
{
- cmsysProcess_SetPipeFile(cp, cmsysProcess_Pipe_STDERR,
- error_file.c_str());
+ if (error_file == output_file)
+ {
+ merge_output = true;
+ }
+ else
+ {
+ cmsysProcess_SetPipeFile(cp, cmsysProcess_Pipe_STDERR,
+ error_file.c_str());
+ }
+ }
+ if (!output_variable.empty() && output_variable == error_variable)
+ {
+ merge_output = true;
+ }
+ if (merge_output)
+ {
+ cmsysProcess_SetOption(cp, cmsysProcess_Option_MergeOutput, 1);
}
// Set the timeout if any.
@@ -289,8 +304,7 @@ bool cmExecuteProcessCommand
while((p = cmsysProcess_WaitForData(cp, &data, &length, 0), p))
{
// Put the output in the right place.
- if((p == cmsysProcess_Pipe_STDOUT && !output_quiet) ||
- (p == cmsysProcess_Pipe_STDERR && !error_quiet && merge_output))
+ if (p == cmsysProcess_Pipe_STDOUT && !output_quiet)
{
if(output_variable.empty())
{