Implement Ctrl-C handling and fix a large number of small bugs

This commit is contained in:
2019-09-28 19:46:10 +01:00
parent 006f8db6f6
commit 15ca45e5df
12 changed files with 88 additions and 61 deletions

View File

@@ -1,18 +1,21 @@
#!/usr/bin/env python
from twisted.internet import reactor
from twisted.internet.ssl import DefaultOpenSSLContextFactory
from sys import argv, stdout, stderr
import sys
from signal import signal, SIGINT
#from twisted.python import log
#from sys import stdout
#log.startLogging(stdout)
from sys import stdout, stderr # Import again because we want to override
from codecs import getwriter # fix printing odd shit to the terminal
stdout = getwriter("utf8")(stdout) # this is a generic fix but we all know
stderr = getwriter("utf8")(stderr) # it's just for the retards on Rizon using
# unicode quit messages for no reason
import main
main.initMain()
if "--debug" in argv: # yes really
from utils.cleanup import handler
signal(SIGINT, handler) # Handle Ctrl-C and run the cleanup routine
if "--debug" in sys.argv: # yes really
main.config["Debug"] = True
from utils.logging.log import *
from utils.loaders.command_loader import loadCommands