summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--run-command.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/run-command.c b/run-command.c
index e273c6c451..30c2b3dd88 100644
--- a/run-command.c
+++ b/run-command.c
@@ -248,7 +248,14 @@ static int wait_or_whine(pid_t pid, const char *argv0)
} else if (waiting != pid) {
error("waitpid is confused (%s)", argv0);
} else if (WIFSIGNALED(status)) {
- error("%s died of signal", argv0);
+ code = WTERMSIG(status);
+ error("%s died of signal %d", argv0, code);
+ /*
+ * This return value is chosen so that code & 0xff
+ * mimics the exit code that a POSIX shell would report for
+ * a program that died from this signal.
+ */
+ code -= 128;
} else if (WIFEXITED(status)) {
code = WEXITSTATUS(status);
/*