Robert Collins added the comment:

def main():
   try:
       thing()
   except SomethingChanged:
       exit(1)
   except BinaryDiff:
       exit(2)
   except:
       exit(3)

This is the sort of pattern e.g. 'diff' has. 

Should exit(3) there become exit(1) ? exit(1) means 'succeeded and there were 
changes'. So no, 3,for this app, means 'broke entirely'.

Exiting with '1' is also poor/confusing for this app. So perhaps we should pick 
something rarely used - like 255. But anyhow the same logic applies: if an app 
signals 'error' with a different code, we shouldn't change the apps 'error' 
signal to be something else when we detect an error.

But OTOH preserving a non-zero not-error code when an error occurs is also 
wrong.

So I think, on reflection:
 1) pick an unusual code. Not 1. Not 77 (automake test skip code). Maybe 255? 
https://www.freebsd.org/cgi/man.cgi?query=sysexits&sektion=3&apropos=0&manpath=FreeBSD+10.2-RELEASE
 defines some codes we should avoid as well.
 2) We document that python itself may cause this exit code to be used and that 
apps written in python should never use that code
 3) we use your patch as it is - on shutdown error force it to this chosen 
value.

What do you think?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue5319>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to