From 7a1907ce2bd8fefd018fb65914d97482a9a88903 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 15 Aug 2019 13:54:53 +0200 Subject: ee: Graceful exit if StopToolException is thrown. --- src/ee/__main__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ee/__main__.py b/src/ee/__main__.py index 3feec33..b6fdd29 100644 --- a/src/ee/__main__.py +++ b/src/ee/__main__.py @@ -56,8 +56,13 @@ def main(): if t.name != name: continue sys.argv[0] = t.name - importlib.import_module(t.module_name) - exit(0) + try: + importlib.import_module(t.module_name) + exit(0) + except ee.StopToolException as e: + if e.args: + print("{}: {}".format(t.name, " ".join(e.args))) + exit(1) eprint("No such tool: {}".format(name)) exit(1) -- cgit v1.2.3