Linux – Program exit state convention

Program exit state convention… here is a solution to the problem.

Program exit state convention

What are the general return values for applications in Windows and GNU/Linux, respectively. 0 indicates success. But what should be used on the abort requested by the user. When I abort on Windows, it returns 3, but if it’s not ERROR_PATH_NOT_FOUND, the value isn’t in the list of system error codes. GNU binutils uses 1. From the user’s perspective, it would be nice to return GetLastError or errno because they are documented, but these only seem to cover lower-level status codes. I’m looking for a value that stands for “Application not terminated successfully”

The reason I got hurt was that I thought


From a signal handler that catches some access violations after printing a message about where it occurred/SIGSEGV (i.e. programming error). The error code should then be recognizable from the user input error.


This may help, < a href="" rel="noreferrer noopener nofollow" > These are standard exit codes. I think the rest depends on the program. Basically you need to verify the documentation for the specific software you are looking for. As @devnull says, any non-zero exit code means unsuccessful termination

Related Problems and Solutions