From 8b078383c2e7992348e1371387351ceb7a2f73e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Molinero=20Fern=C3=A1ndez?= Date: Tue, 14 Jan 2020 22:23:01 +0100 Subject: [PATCH] Use "sys.exit" instead of "exit" builtin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Héctor Molinero Fernández --- bin/pwnagotchi | 9 +++++---- pwnagotchi/ui/hw/libs/dfrobot/dfrobot_epaper.py | 2 +- pwnagotchi/utils.py | 5 +++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index ac488b6..a30fcea 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -4,6 +4,7 @@ import argparse import time import yaml import signal +import sys import pwnagotchi import pwnagotchi.grid as grid @@ -19,7 +20,7 @@ from pwnagotchi import restart def do_clear(display): logging.info("clearing the display ...") display.clear() - exit(0) + sys.exit(0) def do_manual_mode(agent): @@ -115,12 +116,12 @@ if __name__ == '__main__': if args.version: print(pwnagotchi.version) - exit(0) + sys.exit(0) config = utils.load_config(args) if args.print_config: print(toml.dumps(config)) - exit(0) + sys.exit(0) utils.setup_logging(args, config) @@ -132,7 +133,7 @@ if __name__ == '__main__': if args.do_clear: do_clear(display) - exit(0) + sys.exit(0) agent = Agent(view=display, config=config, keypair=KeyPair(view=display)) diff --git a/pwnagotchi/ui/hw/libs/dfrobot/dfrobot_epaper.py b/pwnagotchi/ui/hw/libs/dfrobot/dfrobot_epaper.py index 8182bee..8858dd4 100644 --- a/pwnagotchi/ui/hw/libs/dfrobot/dfrobot_epaper.py +++ b/pwnagotchi/ui/hw/libs/dfrobot/dfrobot_epaper.py @@ -11,7 +11,7 @@ try: from .gpio import GPIO except: print("unknown platform") - exit() + sys.exit() CONFIG_IL0376F = { diff --git a/pwnagotchi/utils.py b/pwnagotchi/utils.py index 99dc936..03c0fd7 100644 --- a/pwnagotchi/utils.py +++ b/pwnagotchi/utils.py @@ -13,6 +13,7 @@ import gzip import contextlib import tempfile import toml +import sys import pwnagotchi @@ -92,7 +93,7 @@ def load_config(args): config = merge_config(user_config, config) except Exception as ex: logging.error("There was an error processing the configuration file:\n%s ",ex) - exit(1) + sys.exit(1) # the very first step is to normalize the display name so we don't need dozens of if/elif around if config['ui']['display']['type'] in ('inky', 'inkyphat'): @@ -139,7 +140,7 @@ def load_config(args): else: print("unsupported display type %s" % config['ui']['display']['type']) - exit(1) + sys.exit(1) return config