From: Jeff King Date: Wed, 28 Jan 2009 07:36:39 GMT Subject: [PATCHv2 3/4] run-command: help callers distinguish errors Message-ID: <20090128073639.GC31884@coredump.intra.peff.net> In-Reply-To: <20090128073059.GD19165@coredump.intra.peff.net> 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 --- New since v1 of the series. run-command.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/run-command.h b/run-command.h index 0211e1d..a88b3cd 100644 --- a/run-command.h +++ b/run-command.h @@ -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; -- 1.6.1.1.367.g30b36