-
Committer:
Scott Moser
-
Date:
2015-10-02 19:47:51 UTC
-
mfrom:
(273.1.3 trunk.no-exit)
-
Revision ID:
smoser@ubuntu.com-20151002194751-m0prm774otd3cmjb
fix reporting of FAIL when a subcommand exited 0
I noticed that the reporting code was catching a FAIL operation on
curthooks. This was because the command was using sys.exit(0), which
would be caught by the 'except' branch of main.
SystemExit inherits from BaseException, not Exception.
The __exit__ args.reportstack would get the exception and mark the
report event as FAIL because it got non-None as the 'exc_value').
The changes here are then:
a.) make more commands explicilty exit 0 or exit non-zero
some were just returning the main without any value.
b.) make args.reportstack handle SystemExit specially.
a SystemExit of 0 is now not an error that causes FAIL
Essentially, this now better supports this code fragment:
with ReportStack():
sys.exit(0)
The ReportStack there will actually mark Fail (as it's __exit__ is
provided an exception), but the parent process will only see the 'exit 0'
which will look like all is good. That was very confusing to me when i
saw curthooks posting a FAIL and it not propogating up.