BUG: even safer checking of return value

This commit is contained in:
Ken Martin 2007-03-28 11:06:34 -04:00
parent c6cf2ca108
commit f0857fcbd3
1 changed files with 27 additions and 22 deletions

View File

@ -691,12 +691,14 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command,
int result = cmsysProcess_GetState(cp); int result = cmsysProcess_GetState(cp);
if(result == cmsysProcess_State_Exited) if(result == cmsysProcess_State_Exited)
{
if (retVal)
{ {
*retVal = cmsysProcess_GetExitValue(cp); *retVal = cmsysProcess_GetExitValue(cp);
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Command exited with the value: " << *retVal << std::endl); "Command exited with the value: " << *retVal << std::endl);
// if a non zero return value // if a non zero return value
if (retVal && *retVal) if (*retVal)
{ {
// If there was an error running command, report that on the dashboard. // If there was an error running command, report that on the dashboard.
cmCTestBuildErrorWarning errorwarning; cmCTestBuildErrorWarning errorwarning;
@ -712,11 +714,14 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command,
} }
} }
else if(result == cmsysProcess_State_Exception) else if(result == cmsysProcess_State_Exception)
{
if (retVal)
{ {
*retVal = cmsysProcess_GetExitException(cp); *retVal = cmsysProcess_GetExitException(cp);
cmCTestLog(this->CTest, WARNING, "There was an exception: " << *retVal cmCTestLog(this->CTest, WARNING, "There was an exception: " << *retVal
<< std::endl); << std::endl);
} }
}
else if(result == cmsysProcess_State_Expired) else if(result == cmsysProcess_State_Expired)
{ {
cmCTestLog(this->CTest, WARNING, "There was a timeout" << std::endl); cmCTestLog(this->CTest, WARNING, "There was a timeout" << std::endl);