Merge "swift-ring-builder: exit ERROR (2) on uncaught exceptions"
This commit is contained in:
commit
f15c4cc6b5
@ -16,9 +16,22 @@
|
||||
|
||||
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
# We exit code 1 on WARNING statuses, 2 on ERROR. This means we need
|
||||
# to handle any uncaught exceptions by printing the usual backtrace,
|
||||
# but then exiting 2 (not 1 as is usual for a python
|
||||
# exception).
|
||||
|
||||
|
||||
def exit_with_status_two(tp, val, tb):
|
||||
traceback.print_exception(tp, val, tb)
|
||||
sys.exit(2)
|
||||
|
||||
|
||||
sys.excepthook = exit_with_status_two
|
||||
|
||||
from swift.cli.ringbuilder import main
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
|
Loading…
x
Reference in New Issue
Block a user