diff options
author | Casey Deccio <casey@deccio.net> | 2015-10-14 00:17:06 +0300 |
---|---|---|
committer | Casey Deccio <casey@deccio.net> | 2015-10-14 00:17:06 +0300 |
commit | 6b18b73488607b322c151187eb085b0c804318e5 (patch) | |
tree | 8a93e56b70cb964411b76899090717d9c1bdb2e8 /bin | |
parent | 025fd8a72a8b5ecc93d71c19e0fdbb8ba8ab20d5 (diff) |
Make command detection more robust
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/dnsviz | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -56,6 +56,13 @@ def main(): try: mod = importlib.import_module('dnsviz.commands.%s' % command) except ImportError: + # if there are more than two frames in the stack trace, + # then the command was legit, but there was an ImportError + # raised while running that command. + exc_frame = sys.exc_info()[2] + if exc_frame.tb_next.tb_next is not None: + raise + usage('Invalid command: %s' % command) sys.exit(1) |