summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorBerk Geveci <berk.geveci@kitware.com>2002-05-15 15:11:16 (GMT)
committerBerk Geveci <berk.geveci@kitware.com>2002-05-15 15:11:16 (GMT)
commite10cea0da4b078369c7329f83b915f3bdc58bee0 (patch)
tree57ff0ab0424442c673a05b60c112a4cf6e3d6b7d /Source/cmSystemTools.cxx
parent74da9fb78e1549be0cc599bcddf652aa11b41c2c (diff)
downloadCMake-e10cea0da4b078369c7329f83b915f3bdc58bee0.zip
CMake-e10cea0da4b078369c7329f83b915f3bdc58bee0.tar.gz
CMake-e10cea0da4b078369c7329f83b915f3bdc58bee0.tar.bz2
RunCommand now checks whether the process died abnormally (on Unix)
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx43
1 files 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
}