summaryrefslogtreecommitdiff
path: root/run-command.h
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2009-07-04 21:26:40 +0200
committerJunio C Hamano <gitster@pobox.com>2009-07-06 02:44:49 -0700
commit0ac77ec3150f43a5c2a6b1e47e9db5aafe53fb72 (patch)
tree6410cfd9bdc06db787fb329f8cdf84cb38809881 /run-command.h
parent5709e0363a891b72eb9e9756d7fb121d9bf6a7c7 (diff)
downloadgit-0ac77ec3150f43a5c2a6b1e47e9db5aafe53fb72.tar.gz
run_command: report system call errors instead of returning error codes
The motivation for this change is that system call failures are serious errors that should be reported to the user, but only few callers took the burden to decode the error codes that the functions returned into error messages. If at all, then only an unspecific error message was given. A prominent example is this: $ git upload-pack . | : fatal: unable to run 'git-upload-pack' In this example, git-upload-pack, the external command invoked through the git wrapper, dies due to SIGPIPE, but the git wrapper does not bother to report the real cause. In fact, this very error message is copied to the syslog if git-daemon's client aborts the connection early. With this change, system call failures are reported immediately after the failure and only a generic failure code is returned to the caller. In the above example the error is now to the point: $ git upload-pack . | : error: git-upload-pack died of signal Note that there is no error report if the invoked program terminated with a non-zero exit code, because it is reasonable to expect that the invoked program has already reported an error. (But many run_command call sites nevertheless write a generic error message.) There was one special return code that was used to identify the case where run_command failed because the requested program could not be exec'd. This special case is now treated like a system call failure with errno set to ENOENT. No error is reported in this case, because the call site in git.c expects this as a normal result. Therefore, the callers that carefully decoded the return value still check for this condition. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'run-command.h')
-rw-r--r--run-command.h10
1 files changed, 0 insertions, 10 deletions
diff --git a/run-command.h b/run-command.h
index 0211e1d471..ac6c09c896 100644
--- a/run-command.h
+++ b/run-command.h
@@ -1,16 +1,6 @@
#ifndef RUN_COMMAND_H
#define RUN_COMMAND_H
-enum {
- ERR_RUN_COMMAND_FORK = 10000,
- ERR_RUN_COMMAND_EXEC,
- ERR_RUN_COMMAND_PIPE,
- ERR_RUN_COMMAND_WAITPID,
- ERR_RUN_COMMAND_WAITPID_WRONG_PID,
- ERR_RUN_COMMAND_WAITPID_SIGNAL,
- ERR_RUN_COMMAND_WAITPID_NOEXIT,
-};
-
struct child_process {
const char **argv;
pid_t pid;