diff --git a/src/wormhole/cli/cli.py b/src/wormhole/cli/cli.py index dd0c010..8e48bbd 100644 --- a/src/wormhole/cli/cli.py +++ b/src/wormhole/cli/cli.py @@ -3,7 +3,7 @@ from __future__ import print_function import os import time start = time.time() -import traceback +from os.path import expanduser, exists from textwrap import fill, dedent from sys import stdout, stderr from . import public_relay @@ -11,6 +11,7 @@ from .. import __version__ from ..timing import DebugTiming from ..errors import WrongPasswordError, WelcomeError, KeyFormatError from twisted.internet.defer import inlineCallbacks, maybeDeferred +from twisted.python.failure import Failure from twisted.internet.task import react import click @@ -111,7 +112,10 @@ def _dispatch_command(reactor, cfg, command): msg = fill("ERROR: " + dedent(e.__doc__)) print(msg, file=stderr) except Exception as e: - traceback.print_exc() + # this prints a proper traceback, whereas + # traceback.print_exc() just prints a TB to the "yield" + # line above ... + Failure().printTraceback(file=stderr) print("ERROR:", e, file=stderr) raise SystemExit(1)