RunCommand now checks whether the process died abnormally (on Unix)

This commit is contained in:
Berk Geveci 2002-05-15 11:11:16 -04:00
parent 74da9fb78e
commit e10cea0da4
1 changed files with 41 additions and 2 deletions

View File

@ -1388,8 +1388,47 @@ bool cmSystemTools::RunCommand(const char* command,
}
retVal = pclose(cpipe);
retVal = WEXITSTATUS(retVal);
return true;
if (WIFEXITED(retVal))
{
retVal = WEXITSTATUS(retVal);
return true;
}
if (WIFSIGNALED(retVal))
{
retVal = WTERMSIG(retVal);
std::strstream error;
error << "\nProcess terminated due to ";
switch (retVal)
{
#ifdef SIGKILL
case SIGKILL:
error << "SIGKILL";
break;
#endif
#ifdef SIGFPE
case SIGFPE:
error << "SIGFPE";
break;
#endif
#ifdef SIGBUS
case SIGBUS:
error << "SIGBUS";
break;
#endif
#ifdef SIGSEGV
case SIGSEGV:
error << "SIGSEGV";
break;
#endif
default:
error << "signal " << retVal;
break;
}
error << std::ends;
output += error.str();
error.rdbuf()->freeze(0);
}
return false;
#endif
}