diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2019-08-15 13:54:53 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2019-08-15 13:54:53 +0200 |
commit | 7a1907ce2bd8fefd018fb65914d97482a9a88903 (patch) | |
tree | 538553cb4c4d81a9ae2dc0ade7373732be518384 | |
parent | db80ff609d570f6074eb35758304a0141a24050a (diff) | |
download | ee-python-7a1907ce2bd8fefd018fb65914d97482a9a88903.tar.gz ee-python-7a1907ce2bd8fefd018fb65914d97482a9a88903.tar.bz2 ee-python-7a1907ce2bd8fefd018fb65914d97482a9a88903.tar.xz ee-python-7a1907ce2bd8fefd018fb65914d97482a9a88903.zip |
ee: Graceful exit if StopToolException is thrown.
-rw-r--r-- | src/ee/__main__.py | 9 |
1 files changed, 7 insertions, 2 deletions
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) |