From 083003191f2dc1c36464ef3dd767adf9adbc5da6 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Sat, 1 Sep 2018 23:55:24 -0500 Subject: [PATCH] work on cliui --- onionr/core.py | 1 + onionr/static-data/default-plugins/cliui/main.py | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/onionr/core.py b/onionr/core.py index 9cd06043..ab8b640b 100644 --- a/onionr/core.py +++ b/onionr/core.py @@ -389,6 +389,7 @@ class Core: conn.close() except sqlite3.OperationalError: retData = False + self.daemonQueue() events.event('queue_push', data = {'command': command, 'data': data}, onionr = None) return retData diff --git a/onionr/static-data/default-plugins/cliui/main.py b/onionr/static-data/default-plugins/cliui/main.py index 81af13c2..961bbddb 100644 --- a/onionr/static-data/default-plugins/cliui/main.py +++ b/onionr/static-data/default-plugins/cliui/main.py @@ -53,7 +53,7 @@ class OnionrCLIUI: while showMenu: if firstRun: print("please wait while Onionr starts...") - subprocess.Popen(["./onionr.py", "start"], stdin=subprocess.PIPE, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT) + daemon = subprocess.Popen(["./onionr.py", "start"], stdin=subprocess.PIPE, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT) time.sleep(30) firstRun = False @@ -93,12 +93,13 @@ Daemon Running: ''' + isOnline + ''' print("Onionr daemon will shutdown...") #self.myCore._utils.localCommand("shutdown") self.myCore.daemonQueueAdd('shutdown') - while self.myCore._utils.localCommand('ping') == 'pong': - self.myCore.daemonQueueAdd('shutdown') - time.sleep(8) + try: + daemon.kill() + except UnboundLocalError: + pass else: print("Starting Daemon...") - subprocess.Popen(["./onionr.py", "start"], stdin=subprocess.PIPE, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT) + daemon = subprocess.Popen(["./onionr.py", "start"], stdin=subprocess.PIPE, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT) elif choice in ("6", "quit"): showMenu = False elif choice == "":