aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-08-15 13:54:53 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2019-08-15 13:54:53 +0200
commit7a1907ce2bd8fefd018fb65914d97482a9a88903 (patch)
tree538553cb4c4d81a9ae2dc0ade7373732be518384
parentdb80ff609d570f6074eb35758304a0141a24050a (diff)
downloadee-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__.py9
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)