summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorJohan Björk <phb@spotify.com>2011-07-26 07:26:18 (GMT)
committerBrad King <brad.king@kitware.com>2011-07-28 14:42:03 (GMT)
commit856a9e499f299a33cb4f763bf36a75524a03e4f5 (patch)
tree794e18a7cef0ec581600e271ffd0a7a842d4a6a2 /Source/cmSystemTools.cxx
parent4096066723ec7dd6f450e1c8da13616c0ca2f124 (diff)
downloadCMake-856a9e499f299a33cb4f763bf36a75524a03e4f5.zip
CMake-856a9e499f299a33cb4f763bf36a75524a03e4f5.tar.gz
CMake-856a9e499f299a33cb4f763bf36a75524a03e4f5.tar.bz2
RunSingleCommand: Replace verbose boolean with enum
No behaviour change, this prepares for adding a flag to skip the merging of output streams.
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx24
1 files changed, 13 insertions, 11 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 526ae3d..ba620d1 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -577,7 +577,7 @@ std::vector<cmStdString> cmSystemTools::ParseArguments(const char* command)
bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
std::string* output ,
int* retVal , const char* dir ,
- bool verbose ,
+ OutputOption outputflag ,
double timeout )
{
std::vector<const char*> argv;
@@ -599,17 +599,19 @@ bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
{
cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1);
}
+
cmsysProcess_SetTimeout(cp, timeout);
cmsysProcess_Execute(cp);
std::vector<char> tempOutput;
char* data;
int length;
- if ( output || verbose )
+ int pipe;
+ if ( output || outputflag != OUTPUT_NONE )
{
- while(cmsysProcess_WaitForData(cp, &data, &length, 0))
+ while((pipe = cmsysProcess_WaitForData(cp, &data, &length, 0)))
{
- if(output || verbose)
+ if(output || outputflag != OUTPUT_NONE)
{
// Translate NULL characters in the output into valid text.
// Visual Studio 7 puts these characters in the output of its
@@ -626,7 +628,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
{
tempOutput.insert(tempOutput.end(), data, data+length);
}
- if(verbose)
+ if(outputflag != OUTPUT_NONE)
{
cmSystemTools::Stdout(data, length);
}
@@ -657,7 +659,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
else if(cmsysProcess_GetState(cp) == cmsysProcess_State_Exception)
{
const char* exception_str = cmsysProcess_GetExceptionString(cp);
- if ( verbose )
+ if ( outputflag != OUTPUT_NONE )
{
std::cerr << exception_str << std::endl;
}
@@ -670,7 +672,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
else if(cmsysProcess_GetState(cp) == cmsysProcess_State_Error)
{
const char* error_str = cmsysProcess_GetErrorString(cp);
- if ( verbose )
+ if ( outputflag != OUTPUT_NONE )
{
std::cerr << error_str << std::endl;
}
@@ -683,7 +685,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
else if(cmsysProcess_GetState(cp) == cmsysProcess_State_Expired)
{
const char* error_str = "Process terminated due to timeout\n";
- if ( verbose )
+ if ( outputflag != OUTPUT_NONE )
{
std::cerr << error_str << std::endl;
}
@@ -703,12 +705,12 @@ bool cmSystemTools::RunSingleCommand(
std::string* output,
int *retVal,
const char* dir,
- bool verbose,
+ OutputOption outputflag,
double timeout)
{
if(s_DisableRunCommandOutput)
{
- verbose = false;
+ outputflag = OUTPUT_NONE;
}
std::vector<cmStdString> args = cmSystemTools::ParseArguments(command);
@@ -718,7 +720,7 @@ bool cmSystemTools::RunSingleCommand(
return false;
}
return cmSystemTools::RunSingleCommand(args, output,retVal,
- dir, verbose, timeout);
+ dir, outputflag, timeout);
}
bool cmSystemTools::RunCommand(const char* command,
std::string& output,