@matheusbsbs / matheus-bagliano / commits / 1d64f21d99
Fork 0

run_command(): help callers distinguish errors

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>

Jeff King committed Jan 28, 2009 at 02:36 UTC 1d64f21d9949ac1dd59fa722160e46181d92854d
1 file changed +1
run-command.h
+1
@@ -10,6 +10,7 @@ enum {
10 ERR_RUN_COMMAND_WAITPID_SIGNAL,
11 ERR_RUN_COMMAND_WAITPID_NOEXIT,
12 };
13 +#define IS_RUN_COMMAND_ERR(x) ((x) <= -ERR_RUN_COMMAND_FORK)
14
15 struct child_process {
16 const char **argv;