summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/cli/bitmask_cli.py
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2016-10-05 12:18:02 -0400
committerKali Kaneko (leap communications) <kali@leap.se>2016-10-07 10:22:36 -0400
commit4a471fb8b434d3df07c5de42fc41590b5d9fc5f5 (patch)
treeca72e66088ac8fea08c74e80405006afa66788c5 /src/leap/bitmask/cli/bitmask_cli.py
parent01ff6420b503ed98cc04f295fec1d803d31b97fb (diff)
[feature] logs watch command
Diffstat (limited to 'src/leap/bitmask/cli/bitmask_cli.py')
-rwxr-xr-xsrc/leap/bitmask/cli/bitmask_cli.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/leap/bitmask/cli/bitmask_cli.py b/src/leap/bitmask/cli/bitmask_cli.py
index 736e737..ab3c206 100755
--- a/src/leap/bitmask/cli/bitmask_cli.py
+++ b/src/leap/bitmask/cli/bitmask_cli.py
@@ -20,6 +20,7 @@ Bitmask Command Line interface: zmq client.
"""
import json
import sys
+import signal
from colorama import Fore
from twisted.internet import reactor, defer
@@ -125,15 +126,25 @@ def execute():
errb=lambda: cli.start(None))
cli.data = []
yield cli.execute(sys.argv[1:])
- yield reactor.stop()
+ try:
+ yield reactor.stop()
+ except:
+ pass
def _null_printer(*args):
pass
+
def main():
+ def signal_handler(signal, frame):
+ if reactor.running:
+ reactor.stop()
+ sys.exit(0)
+
reactor.callWhenRunning(reactor.callLater, 0, execute)
+ signal.signal(signal.SIGINT, signal_handler)
reactor.run()
if __name__ == "__main__":