Correcting the Shutdown System

This commit is contained in:
Adrien Bourmault 2019-07-11 16:04:18 +02:00 committed by GitHub
parent 9db083ba38
commit 75e0a85a86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 10 deletions

View File

@ -34,11 +34,14 @@ import launcher # launcher.py
import updater # updater.py
import globs # globs.py
import pytesseract # pytesseract.py
import logger # logger.py
# Global handler
logfile = logger.logCur
## MAIN FUNCTION OF CNIREVELATOR
def main():
import logger # logger.py
logfile = logger.logCur
logfile.printdbg('*** CNIRevelator LOGFILE. Hello World ! ***')
@ -70,7 +73,7 @@ try:
launcherThread = threading.Thread(target=updater.umain, daemon=False)
launcher.lmain(launcherThread)
except Exception:
sys.exit(1)
updater.exitProcess(1)
if updater.UPDATE_IS_MADE:
# Launch app !
@ -83,15 +86,10 @@ if updater.UPDATE_IS_MADE:
time.sleep(3)
continue
break
sys.exit(0)
updater.exitProcess(0)
# Here we go !
try:
main()
except Exception:
sys.exit(1)
# Quit totally without remain in memory
for process in psutil.process_iter():
if process.pid == os.getpid():
process.terminate()
updater.exitProcess(1)

View File

@ -63,6 +63,13 @@ def createShortcut(path, target='', wDir='', icon=''):
def spawnProcess(args, cd):
subprocess.Popen(args, close_fds=True, cwd=cd, creationflags=subprocess.DETACHED_PROCESS)
def exitProcess(arg):
# Quit totally without remain in memory
for process in psutil.process_iter():
if process.pid == os.getpid():
process.terminate()
sys.exit(arg)
## Main Batch Function
def batch():