Use sys.exit instead of global
This commit is contained in:
parent
51131813a3
commit
05e15e27ef
3 changed files with 7 additions and 6 deletions
|
|
@ -39,18 +39,18 @@ def main():
|
|||
command.sys_dispatch()
|
||||
except KeyboardInterrupt:
|
||||
log.error("\nAborting.")
|
||||
exit(1)
|
||||
sys.exit(1)
|
||||
except (UserError, NoSuchService, DependencyError) as e:
|
||||
log.error(e.msg)
|
||||
exit(1)
|
||||
sys.exit(1)
|
||||
except NoSuchCommand as e:
|
||||
log.error("No such command: %s", e.command)
|
||||
log.error("")
|
||||
log.error("\n".join(parse_doc_section("commands:", getdoc(e.supercommand))))
|
||||
exit(1)
|
||||
sys.exit(1)
|
||||
except APIError as e:
|
||||
log.error(e.explanation)
|
||||
exit(1)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
# stolen from docopt master
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue