summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0ac77ec)
raw | patch | inline | side by side (parent: 0ac77ec)
author | Johannes Sixt <j6t@kdbg.org> | |
Sat, 4 Jul 2009 19:26:41 +0000 (21:26 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 6 Jul 2009 09:44:56 +0000 (02:44 -0700) |
We now write the signal number in the error message if the program
terminated by a signal. The negative return value is constructed such that
after truncation to 8 bits it looks like a POSIX shell's $?:
$ echo 0000 | { git upload-pack .; echo $? >&2; } | :
error: git-upload-pack died of signal 13
141
Previously, the exit code was 255 instead of 141.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
terminated by a signal. The negative return value is constructed such that
after truncation to 8 bits it looks like a POSIX shell's $?:
$ echo 0000 | { git upload-pack .; echo $? >&2; } | :
error: git-upload-pack died of signal 13
141
Previously, the exit code was 255 instead of 141.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
run-command.c | patch | blob | history |
diff --git a/run-command.c b/run-command.c
index e273c6c451836148e64fa8a954348b8d9de21a60..30c2b3dd8826acd3b50ab18e8efb4ff473fd7cf2 100644 (file)
--- a/run-command.c
+++ b/run-command.c
} 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);
/*