1
0
mirror of https://gitlab.os-k.eu/neox/CNIRevelator.git synced 2023-08-25 14:03:10 +02:00

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

View File

@ -63,6 +63,13 @@ def createShortcut(path, target='', wDir='', icon=''):
def spawnProcess(args, cd): def spawnProcess(args, cd):
subprocess.Popen(args, close_fds=True, cwd=cd, creationflags=subprocess.DETACHED_PROCESS) 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 ## Main Batch Function
def batch(): def batch():