From 3764c1a115618f94947a6383e53eab55b5539021 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Sat, 3 Nov 2018 22:26:18 -0500 Subject: [PATCH] fixed bug where process would not die --- onionr/onionr.py | 12 +++++++++--- onionr/static-data/bootstrap-nodes.txt | 2 -- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/onionr/onionr.py b/onionr/onionr.py index 97781f0c..eceb7639 100755 --- a/onionr/onionr.py +++ b/onionr/onionr.py @@ -640,7 +640,7 @@ class Onionr: logger.info('Our Public key: ' + self.onionrCore._crypto.pubKey) time.sleep(1) #TODO make runable on windows - subprocess.Popen([communicatorDaemon, "run", str(net.socksPort)]) + communicatorProc = subprocess.Popen([communicatorDaemon, "run", str(net.socksPort)]) # Print nice header thing :) if config.get('general.display_header', True): self.header() @@ -649,6 +649,9 @@ class Onionr: try: while True: time.sleep(5) + # Break if communicator process ends, so we don't have left over processes + if communicatorProc.poll() is not None: + break except KeyboardInterrupt: self.onionrCore.daemonQueueAdd('shutdown') self.onionrUtils.localCommand('shutdown') @@ -789,11 +792,14 @@ class Onionr: ''' Get a file from onionr blocks ''' - if len(sys.argv) >= 3: + try: fileName = sys.argv[2] + bHash = sys.argv[3] + except IndexError: + logger.error("Syntax %s %s" % (sys.argv[0], '/path/to/filename ')) + else: print(fileName) contents = None - bHash = sys.argv[3] if os.path.exists(fileName): logger.error("File already exists") return diff --git a/onionr/static-data/bootstrap-nodes.txt b/onionr/static-data/bootstrap-nodes.txt index 5473550f..e69de29b 100644 --- a/onionr/static-data/bootstrap-nodes.txt +++ b/onionr/static-data/bootstrap-nodes.txt @@ -1,2 +0,0 @@ -onionragxuddecmg.onion -dgyllprmtmym4gbk.onion