Skip to content

Commit

Permalink
add crash handler to tn-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Nov 26, 2020
1 parent 2769667 commit 287e50c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tn-cli/tn-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from tn_globals import to_json

APP_NAME = "tn-cli"
APP_VERSION = "1.5.4"
APP_VERSION = "1.5.5"
PROTOCOL_VERSION = "0"
LIB_VERSION = pkg_resources.get_distribution("tinode_grpc").version
GRPC_VERSION = pkg_resources.get_distribution("grpcio").version
Expand All @@ -61,6 +61,13 @@
# This is needed for gRPC SSL to work correctly.
os.environ["GRPC_SSL_CIPHER_SUITES"] = "HIGH+ECDSA"

# Setup crash handler: close input reader otherwise a crash
# makes terminal session unusable.
def exception_hook(type, value, traceBack):
if tn_globals.InputThread != None:
tn_globals.InputThread.join(0.3)
sys.excepthook = exception_hook

# Enable the following variables for debugging.
# os.environ["GRPC_TRACE"] = "all"
# os.environ["GRPC_VERBOSITY"] = "INFO"
Expand Down

0 comments on commit 287e50c

Please sign in to comment.