I'm writing a python application that runs in a cross platform environment. Every once in awhile I have to use a sys.exit to stop the program when something goes wrong (or if something goes right). I'd like to use standardized exit codes beyond just 1
if something went wrong. Looking at the python os
module documentation page (https://docs.python.org/3/library/os.html#os.EX_OK) I see a nice list of 16 posix standard exit codes.
I wanted to find if there were any win32 exit codes that correspond roughly to these posix codes. What I found was 16000 different exit codes: https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx
Fortunately, the first error message was ERROR_SUCCESS = 0x0
, which corresponds nicely to os.EX_OK
.
I then looked for something that migh correspond to os.EX_SOFTWARE
, but the only thing I found that might work is ERROR_FATAL_APP_EXIT = 0x2C9
, but I'm not sure if there might be anything better. The list is too large to efficiently search through.
Is there any standard list (complete or incomplete) of WIN32 error codes that roughly correspond to posix codes? Or is there some agreed upon way to return cross-platform error codes?