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

View File

@ -692,30 +692,35 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command,
if(result == cmsysProcess_State_Exited) if(result == cmsysProcess_State_Exited)
{ {
*retVal = cmsysProcess_GetExitValue(cp); if (retVal)
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Command exited with the value: " << *retVal << std::endl);
// if a non zero return value
if (retVal && *retVal)
{ {
// If there was an error running command, report that on the dashboard. *retVal = cmsysProcess_GetExitValue(cp);
cmCTestBuildErrorWarning errorwarning; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
errorwarning.LogLine = 1; "Command exited with the value: " << *retVal << std::endl);
errorwarning.Text // if a non zero return value
= "*** WARNING non-zero return value in ctest from: "; if (*retVal)
errorwarning.Text += argv[0]; {
errorwarning.PreContext = ""; // If there was an error running command, report that on the dashboard.
errorwarning.PostContext = ""; cmCTestBuildErrorWarning errorwarning;
errorwarning.Error = false; errorwarning.LogLine = 1;
this->ErrorsAndWarnings.push_back(errorwarning); errorwarning.Text
this->TotalWarnings ++; = "*** WARNING non-zero return value in ctest from: ";
errorwarning.Text += argv[0];
errorwarning.PreContext = "";
errorwarning.PostContext = "";
errorwarning.Error = false;
this->ErrorsAndWarnings.push_back(errorwarning);
this->TotalWarnings ++;
}
} }
} else if(result == cmsysProcess_State_Exception)
else if(result == cmsysProcess_State_Exception) {
{ if (retVal)
*retVal = cmsysProcess_GetExitException(cp); {
cmCTestLog(this->CTest, WARNING, "There was an exception: " << *retVal *retVal = cmsysProcess_GetExitException(cp);
<< std::endl); cmCTestLog(this->CTest, WARNING, "There was an exception: " << *retVal
<< std::endl);
}
} }
else if(result == cmsysProcess_State_Expired) else if(result == cmsysProcess_State_Expired)
{ {