From b8113f8e97f9da33698acef417d5b5bc7dcc11ff Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Sat, 15 Dec 2018 21:05:27 -0800 Subject: [PATCH] STATUS_INVALID_ARGS = 2 The rest of the high-numbered exit codes are not values used by scripts or builtins, they are internal to fish and come out of the parser for example. Prior to adding STATUS_INVALID_ARGS, builtins were usually exiting 2 if they had a special exit status for the situation of bad arguments. Set it to 2. --- src/common.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common.h b/src/common.h index 83d6cd0ba..49a381f0f 100644 --- a/src/common.h +++ b/src/common.h @@ -1078,9 +1078,13 @@ enum { STATUS_CMD_OK = 0, /// The status code used for failure exit in a command (but not if the args were invalid). STATUS_CMD_ERROR = 1, + /// The status code used for invalid arguments given to a command. This is distinct from valid + /// arguments that might result in a command failure. An invalid args condition is something + /// like an unrecognized flag, missing or too many arguments, an invalid integer, etc. But + STATUS_INVALID_ARGS = 2, + /// The status code used when a command was not found. STATUS_CMD_UNKNOWN = 127, - /// TODO: Figure out why we have two distinct failure codes for when an external command cannot /// be run. /// @@ -1095,10 +1099,6 @@ enum { STATUS_ILLEGAL_CMD = 123, /// The status code used when `read` is asked to consume too much data. STATUS_READ_TOO_MUCH = 122, - /// The status code used for invalid arguments given to a command. This is distinct from valid - /// arguments that might result in a command failure. An invalid args condition is something - /// like an unrecognized flag, missing or too many arguments, an invalid integer, etc. But - STATUS_INVALID_ARGS = 121, }; /* Normally casting an expression to void discards its value, but GCC