Skip to content

Commit 1d64f21

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 45c0961 commit 1d64f21

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

run-command.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ enum {
1010
ERR_RUN_COMMAND_WAITPID_SIGNAL,
1111
ERR_RUN_COMMAND_WAITPID_NOEXIT,
1212
};
13+
#define IS_RUN_COMMAND_ERR(x) ((x) <= -ERR_RUN_COMMAND_FORK)
1314

1415
struct child_process {
1516
const char **argv;

0 commit comments

Comments
 (0)