From e10cea0da4b078369c7329f83b915f3bdc58bee0 Mon Sep 17 00:00:00 2001 From: Berk Geveci Date: Wed, 15 May 2002 11:11:16 -0400 Subject: RunCommand now checks whether the process died abnormally (on Unix) --- Source/cmSystemTools.cxx | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 0eaaed5..7d51edc 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -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 } -- cgit v0.12