summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/ProcessUNIX.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-05-07 18:34:50 (GMT)
committerBrad King <brad.king@kitware.com>2015-05-07 18:34:50 (GMT)
commit31c218e6e12affd482b9ce2880bd9385c77d9025 (patch)
tree1285f1672ae6f6bc845d0a32e5155881546d84d4 /Source/kwsys/ProcessUNIX.c
parentee1ddec4c19488216289dfd26998091b695bf3ee (diff)
parentac94a796f1f0c5acc06d67d5ad283b29476c1d2e (diff)
downloadCMake-31c218e6e12affd482b9ce2880bd9385c77d9025.zip
CMake-31c218e6e12affd482b9ce2880bd9385c77d9025.tar.gz
CMake-31c218e6e12affd482b9ce2880bd9385c77d9025.tar.bz2
Merge branch 'upstream-kwsys' into update-kwsys
Diffstat (limited to 'Source/kwsys/ProcessUNIX.c')
-rw-r--r--Source/kwsys/ProcessUNIX.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c
index 68722c2..0393a6d 100644
--- a/Source/kwsys/ProcessUNIX.c
+++ b/Source/kwsys/ProcessUNIX.c
@@ -234,6 +234,9 @@ struct kwsysProcess_s
/* Whether to treat command lines as verbatim. */
int Verbatim;
+ /* Whether to merge stdout/stderr of the child. */
+ int MergeOutput;
+
/* Time at which the child started. Negative for no timeout. */
kwsysProcessTime StartTime;
@@ -644,6 +647,7 @@ int kwsysProcess_GetOption(kwsysProcess* cp, int optionId)
switch(optionId)
{
case kwsysProcess_Option_Detach: return cp->OptionDetach;
+ case kwsysProcess_Option_MergeOutput: return cp->MergeOutput;
case kwsysProcess_Option_Verbatim: return cp->Verbatim;
default: return 0;
}
@@ -660,6 +664,7 @@ void kwsysProcess_SetOption(kwsysProcess* cp, int optionId, int value)
switch(optionId)
{
case kwsysProcess_Option_Detach: cp->OptionDetach = value; break;
+ case kwsysProcess_Option_MergeOutput: cp->MergeOutput = value; break;
case kwsysProcess_Option_Verbatim: cp->Verbatim = value; break;
default: break;
}
@@ -997,7 +1002,7 @@ void kwsysProcess_Execute(kwsysProcess* cp)
nextStdIn = p[0];
si.StdOut = p[1];
}
- si.StdErr = cp->PipeChildStd[2];
+ si.StdErr = cp->MergeOutput? cp->PipeChildStd[1] : cp->PipeChildStd[2];
{
int res = kwsysProcessCreate(cp, i, &si);
@@ -1011,7 +1016,7 @@ void kwsysProcess_Execute(kwsysProcess* cp)
{
kwsysProcessCleanupDescriptor(&si.StdOut);
}
- if (si.StdErr != cp->PipeChildStd[2])
+ if (si.StdErr != cp->PipeChildStd[2] && !cp->MergeOutput)
{
kwsysProcessCleanupDescriptor(&si.StdErr);
}