Using sys.exit(main()) instead of main()

TrivialFix: Similar [1] in Kolla project
As we known, Exceptions are raised by the sys.exit() function. When they
are not handled, no stack traceback is printed in the Python interpreter.
Therefore, when using sys.exit(main()) instead of main()
may be more readable and reasonable.

[1] https://review.openstack.org/#/c/349353/

Change-Id: Ied52a7631da82a72f0dcf2fc9ed81840d24041d9
This commit is contained in:
Luong Anh Tuan 2016-09-26 09:24:06 +07:00 committed by Tuan Luong-Anh
parent cc981cf4b9
commit e5cb2569a6
5 changed files with 7 additions and 5 deletions

View File

@ -362,4 +362,4 @@ def main():
pprint.pformat(resp.json())))
if __name__ == '__main__':
main()
sys.exit(main())

View File

@ -208,4 +208,4 @@ def main():
LOG.error(e)
if __name__ == '__main__':
main()
sys.exit(main())

View File

@ -46,6 +46,7 @@ import os
import random
import string
import time
import sys
import dns
import dns.resolver
@ -660,4 +661,4 @@ def main():
if __name__ == '__main__':
main()
sys.exit(main())

View File

@ -19,6 +19,7 @@ Log to stdout or to a file.
"""
from argparse import ArgumentParser
import sys
from time import gmtime
from time import strftime
import SocketServer
@ -57,4 +58,4 @@ def main():
server.serve_forever()
if __name__ == "__main__":
main()
sys.exit(main())

View File

@ -88,4 +88,4 @@ def format_dict(raw):
return output
if __name__ == '__main__':
main()
sys.exit(main())