fixed bug where process would not die

master
Kevin Froman 2018-11-03 22:26:18 -05:00
parent a31a0fd264
commit 3764c1a115
2 changed files with 9 additions and 5 deletions

View File

@ -640,7 +640,7 @@ class Onionr:
logger.info('Our Public key: ' + self.onionrCore._crypto.pubKey) logger.info('Our Public key: ' + self.onionrCore._crypto.pubKey)
time.sleep(1) time.sleep(1)
#TODO make runable on windows #TODO make runable on windows
subprocess.Popen([communicatorDaemon, "run", str(net.socksPort)]) communicatorProc = subprocess.Popen([communicatorDaemon, "run", str(net.socksPort)])
# Print nice header thing :) # Print nice header thing :)
if config.get('general.display_header', True): if config.get('general.display_header', True):
self.header() self.header()
@ -649,6 +649,9 @@ class Onionr:
try: try:
while True: while True:
time.sleep(5) 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: except KeyboardInterrupt:
self.onionrCore.daemonQueueAdd('shutdown') self.onionrCore.daemonQueueAdd('shutdown')
self.onionrUtils.localCommand('shutdown') self.onionrUtils.localCommand('shutdown')
@ -789,11 +792,14 @@ class Onionr:
''' '''
Get a file from onionr blocks Get a file from onionr blocks
''' '''
if len(sys.argv) >= 3: try:
fileName = sys.argv[2] fileName = sys.argv[2]
bHash = sys.argv[3]
except IndexError:
logger.error("Syntax %s %s" % (sys.argv[0], '/path/to/filename <blockhash>'))
else:
print(fileName) print(fileName)
contents = None contents = None
bHash = sys.argv[3]
if os.path.exists(fileName): if os.path.exists(fileName):
logger.error("File already exists") logger.error("File already exists")
return return

View File

@ -1,2 +0,0 @@
onionragxuddecmg.onion
dgyllprmtmym4gbk.onion