summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-07-31 12:48:19 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-07-31 12:48:19 (GMT)
commit6e2da4a4d3a34f62ec830720ab47d344ada73441 (patch)
treecfa3106ec0fdfe8a8eeaf16e4a34f3f0d33b082e /Source
parent8e475470bec1761b9ab338f495e33b145e0ff22e (diff)
parent2b473d2eaa2d09a69fc5a4f37d24ad051d5ead9a (diff)
downloadCMake-6e2da4a4d3a34f62ec830720ab47d344ada73441.zip
CMake-6e2da4a4d3a34f62ec830720ab47d344ada73441.tar.gz
CMake-6e2da4a4d3a34f62ec830720ab47d344ada73441.tar.bz2
Merge topic 'passthru'
2b473d2 Add option to use stdout/stderr of original terminal in cmake --build
Diffstat (limited to 'Source')
-rw-r--r--Source/cmSystemTools.cxx8
-rw-r--r--Source/cmSystemTools.h5
-rw-r--r--Source/cmakemain.cxx7
3 files changed, 15 insertions, 5 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 37344dc..9ec4938 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -638,6 +638,12 @@ bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1);
}
+ if (outputflag == OUTPUT_PASSTHROUGH)
+ {
+ cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDOUT, 1);
+ cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDERR, 1);
+ }
+
cmsysProcess_SetTimeout(cp, timeout);
cmsysProcess_Execute(cp);
@@ -645,7 +651,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
char* data;
int length;
int pipe;
- if ( output || outputflag != OUTPUT_NONE )
+ if(outputflag != OUTPUT_PASSTHROUGH && (output || outputflag != OUTPUT_NONE))
{
while((pipe = cmsysProcess_WaitForData(cp, &data, &length, 0)) > 0)
{
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 9614449..9d7dae9 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -211,7 +211,7 @@ public:
* user-viewable output from the program being run will be generated.
* OUTPUT_MERGE is the legacy behaviour where stdout and stderr are merged
* into stdout. OUTPUT_NORMAL passes through the output to stdout/stderr as
- * it was received.
+ * it was received. OUTPUT_PASSTHROUGH passes through the original handles.
*
* If timeout is specified, the command will be terminated after
* timeout expires. Timeout is specified in seconds.
@@ -230,7 +230,8 @@ public:
{
OUTPUT_NONE = 0,
OUTPUT_MERGE,
- OUTPUT_NORMAL
+ OUTPUT_NORMAL,
+ OUTPUT_PASSTHROUGH
};
static bool RunSingleCommand(const char* command, std::string* output = 0,
int* retVal = 0, const char* dir = 0,
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index f3553f1..68d8339 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -62,7 +62,10 @@ static const char * cmDocumentationDescription[][3] =
" --config <cfg> = For multi-configuration tools, choose <cfg>.\n" \
" --clean-first = Build target 'clean' first, then build.\n" \
" (To clean only, use --target 'clean'.)\n" \
- " --use-stderr = Don't merge stdout/stderr.\n" \
+ " --use-stderr = Don't merge stdout/stderr output and pass the\n" \
+ " original stdout/stderr handles to the native\n" \
+ " tool so it can use the capabilities of the\n" \
+ " calling terminal (e.g. colored output).\n" \
" -- = Pass remaining options to the native tool.\n"
//----------------------------------------------------------------------------
@@ -606,7 +609,7 @@ static int do_build(int ac, char** av)
}
else if(strcmp(av[i], "--use-stderr") == 0)
{
- outputflag = cmSystemTools::OUTPUT_NORMAL;
+ outputflag = cmSystemTools::OUTPUT_PASSTHROUGH;
}
else if(strcmp(av[i], "--") == 0)
{