Skip to content

Commit

Permalink
run_command(): help callers distinguish errors
Browse files Browse the repository at this point in the history
run_command() returns a single integer specifying either an
error code or the exit status of the spawned program. The
only way to tell the difference is that the error codes are
outside of the allowed range of exit status values.

Rather than make each caller implement the test against a
magic limit, let's provide a macro.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Jan 28, 2009
1 parent 45c0961 commit 1d64f21
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions run-command.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ enum {
ERR_RUN_COMMAND_WAITPID_SIGNAL,
ERR_RUN_COMMAND_WAITPID_NOEXIT,
};
#define IS_RUN_COMMAND_ERR(x) ((x) <= -ERR_RUN_COMMAND_FORK)

struct child_process {
const char **argv;
Expand Down

0 comments on commit 1d64f21

Please sign in to comment.