ENH: Improve calling of RunSingle command and fix compile error

This commit is contained in:
Andy Cedilnik 2004-01-26 14:41:29 -05:00
parent 1d958cad60
commit 0217af3b58
2 changed files with 10 additions and 2 deletions

View File

@ -4212,7 +4212,7 @@ int cmCTest::RunCMakeAndTest(std::string* outstring)
out << "Running make command: " << makeCommand.c_str() << "\n"; out << "Running make command: " << makeCommand.c_str() << "\n";
retVal = 0; retVal = 0;
std::string output; std::string output;
if (!cmSystemTools::RunSingleCommand(makeCommand.c_str(), &output, &retVal, 0, false)) if (!cmSystemTools::RunSingleCommand(makeCommand.c_str(), (m_Verbose?&output:0), &retVal, 0, false))
{ {
out << "Error: " << makeCommand.c_str() << " execution failed\n"; out << "Error: " << makeCommand.c_str() << " execution failed\n";
out << output.c_str() << "\n"; out << output.c_str() << "\n";
@ -4464,7 +4464,12 @@ void cmCTest::PopulateCustomVector(cmMakefile* mf, const char* def, tm_VectorOfS
} }
std::vector<std::string> slist; std::vector<std::string> slist;
cmSystemTools::ExpandListArgument(dval, slist); cmSystemTools::ExpandListArgument(dval, slist);
vec.insert(vec.end(), slist.begin(), slist.end()); std::vector<std::string>::iterator it;
for ( it = slist.begin(); it != slist.end(); ++it )
{
vec.push_back(it->c_str());
}
} }
int cmCTest::ExecuteCommands(tm_VectorOfStrings& vec) int cmCTest::ExecuteCommands(tm_VectorOfStrings& vec)

View File

@ -437,6 +437,8 @@ bool cmSystemTools::RunSingleCommand(
std::vector<char> tempOutput; std::vector<char> tempOutput;
char* data; char* data;
int length; int length;
if ( output || verbose )
{
while(cmsysProcess_WaitForData(cp, &data, &length, 0)) while(cmsysProcess_WaitForData(cp, &data, &length, 0))
{ {
if ( output ) if ( output )
@ -448,6 +450,7 @@ bool cmSystemTools::RunSingleCommand(
cmSystemTools::Stdout(data, length); cmSystemTools::Stdout(data, length);
} }
} }
}
cmsysProcess_WaitForExit(cp, 0); cmsysProcess_WaitForExit(cp, 0);
if ( output ) if ( output )