From df303666bceb5715e706478fad0325447a2a52f6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 14 Dec 2007 14:49:35 +0000 Subject: * Use strsignal if available to give better error messages for builders that fail due to a signal. --- src/libutil/util.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/libutil') diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 37e158e4aff0..d0731c0b4827 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -960,8 +961,15 @@ string statusToString(int status) if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { if (WIFEXITED(status)) return (format("failed with exit code %1%") % WEXITSTATUS(status)).str(); - else if (WIFSIGNALED(status)) - return (format("failed due to signal %1%") % WTERMSIG(status)).str(); + else if (WIFSIGNALED(status)) { + int sig = WTERMSIG(status); +#if HAVE_STRSIGNAL + const char * description = strsignal(sig); + return (format("failed due to signal %1% (%2%)") % sig % description).str(); +#else + return (format("failed due to signal %1%") % sig).str(); +#endif + } else return "died abnormally"; } else return "succeeded"; -- cgit 1.4.1