Make shell main() specify return value in exit code
sys.exit() calls in main() will make the interactive python interpreter exit. We can call the main() as below to avoid to exit the interactive interpreter, and specify the return value of main() in the exit code at the same time. sys.exit(main()) also see: I6ead9853fe27e99df3e9121478e906a06839f48c Change-Id: I3086dc0529c4343f246f543de1b6ee6540438a98
This commit is contained in:
parent
77566e52c4
commit
41f7679062
@ -308,13 +308,13 @@ def main(args=None):
|
||||
SenlinShell().main(args)
|
||||
except KeyboardInterrupt:
|
||||
print(_("... terminating senlin client"), file=sys.stderr)
|
||||
sys.exit(130)
|
||||
return 130
|
||||
except Exception as e:
|
||||
if '--debug' in args or '-d' in args:
|
||||
raise
|
||||
else:
|
||||
print(encodeutils.safe_encode(six.text_type(e)), file=sys.stderr)
|
||||
sys.exit(1)
|
||||
return 1
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
sys.exit(main())
|
||||
|
Loading…
x
Reference in New Issue
Block a user