path: root/run-command.h
diff options
authorJohannes Sixt <>2009-07-04 19:26:40 (GMT)
committerJunio C Hamano <>2009-07-06 09:44:49 (GMT)
commit0ac77ec3150f43a5c2a6b1e47e9db5aafe53fb72 (patch)
tree6410cfd9bdc06db787fb329f8cdf84cb38809881 /run-command.h
parent5709e0363a891b72eb9e9756d7fb121d9bf6a7c7 (diff)
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 <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'run-command.h')
1 files changed, 0 insertions, 10 deletions
diff --git a/run-command.h b/run-command.h
index 0211e1d..ac6c09c 100644
--- a/run-command.h
+++ b/run-command.h
@@ -1,16 +1,6 @@
-enum {
struct child_process {
const char **argv;
pid_t pid;