diff --git a/src/shared/exit-status.c b/src/shared/exit-status.c index 21af8c4c719..26b3060d9b9 100644 --- a/src/shared/exit-status.c +++ b/src/shared/exit-status.c @@ -19,9 +19,10 @@ const char* exit_status_to_string(int status, ExitStatusLevel level) { * 79…199 │ (Currently unmapped) * 200…241 │ systemd's private error codes (might be extended to 254 in future development) * 242…254 │ (Currently unmapped, but see above) - * 255 │ (We should probably stay away from that one, it's frequently used by applications to indicate an - * │ exit reason that cannot really be expressed in a single exit status value — such as a propagated - * │ signal or such) + * + * 255 │ EXIT_EXCEPTION (We use this to propagate exit-by-signal events. It's frequently used by others apps (like bash) + * │ to indicate exit reason that cannot really be expressed in a single exit status value — such as a propagated + * │ signal or such, and we follow that logic here.) */ switch (status) { /* We always cover the ISO C ones */ @@ -155,6 +156,9 @@ const char* exit_status_to_string(int status, ExitStatusLevel level) { case EXIT_CONFIGURATION_DIRECTORY: return "CONFIGURATION_DIRECTORY"; + + case EXIT_EXCEPTION: + return "EXCEPTION"; } } diff --git a/src/shared/exit-status.h b/src/shared/exit-status.h index c41e8b82c33..510eb319cf6 100644 --- a/src/shared/exit-status.h +++ b/src/shared/exit-status.h @@ -69,6 +69,8 @@ enum { EXIT_CACHE_DIRECTORY, EXIT_LOGS_DIRECTORY, /* 240 */ EXIT_CONFIGURATION_DIRECTORY, + + EXIT_EXCEPTION = 255, /* Whenever we want to propagate an abnormal/signal exit, in line with bash */ }; typedef enum ExitStatusLevel {