ENH: Put Process execution errors in output and honor verbosity

This commit is contained in:
Andy Cedilnik 2004-02-24 10:04:02 -05:00
parent 34b8852dbe
commit c6c1f70012
1 changed files with 18 additions and 3 deletions

View File

@ -478,17 +478,32 @@ bool cmSystemTools::RunSingleCommand(
} }
else if(cmsysProcess_GetState(cp) == cmsysProcess_State_Exception) else if(cmsysProcess_GetState(cp) == cmsysProcess_State_Exception)
{ {
std::cerr << cmsysProcess_GetExceptionString(cp) << "\n"; const char* exception_str = cmsysProcess_GetExceptionString(cp);
if ( verbose )
{
std::cerr << exception_str << std::endl;
}
output->append(exception_str, strlen(exception_str));
result = false; result = false;
} }
else if(cmsysProcess_GetState(cp) == cmsysProcess_State_Error) else if(cmsysProcess_GetState(cp) == cmsysProcess_State_Error)
{ {
std::cerr << cmsysProcess_GetErrorString(cp) << "\n"; const char* error_str = cmsysProcess_GetErrorString(cp);
if ( verbose )
{
std::cerr << error_str << std::endl;
}
output->append(error_str, strlen(error_str));
result = false; result = false;
} }
else if(cmsysProcess_GetState(cp) == cmsysProcess_State_Expired) else if(cmsysProcess_GetState(cp) == cmsysProcess_State_Expired)
{ {
std::cerr << "Process terminated due to timeout\n"; const char* error_str = "Process terminated due to timeout\n";
if ( verbose )
{
std::cerr << error_str << std::endl;
}
output->append(error_str, strlen(error_str));
result = false; result = false;
} }