Commit fd8ad006 authored by Devaev Maxim's avatar Devaev Maxim

Exceptions instead _exit()

parent 0ea6e604
...@@ -95,10 +95,6 @@ def startDaemon(function, work_dir_path = None, umask = None) : ...@@ -95,10 +95,6 @@ def startDaemon(function, work_dir_path = None, umask = None) :
os.dup2(null_fd, fd) os.dup2(null_fd, fd)
function() function()
else :
os._exit(1)
else :
os._exit(1)
def killDaemon() : def killDaemon() :
pids_list = pidsListOfPythonProc("main.py", ["-k", "--kill"], os.getuid()) # FIXME pids_list = pidsListOfPythonProc("main.py", ["-k", "--kill"], os.getuid()) # FIXME
......
...@@ -55,7 +55,7 @@ class Startup(object) : ...@@ -55,7 +55,7 @@ class Startup(object) :
except : except :
logger.error("Initialization error") logger.error("Initialization error")
logger.attachException() logger.attachException()
sys.exit(1) raise
if self._bus_type != None : if self._bus_type != None :
config.setValue(config.APPLICATION_SECTION, "bus_type", self._bus_type) config.setValue(config.APPLICATION_SECTION, "bus_type", self._bus_type)
...@@ -63,7 +63,7 @@ class Startup(object) : ...@@ -63,7 +63,7 @@ class Startup(object) :
if self._log_level != None : if self._log_level != None :
config.setValue(config.APPLICATION_SECTION, "log_level", self._log_level) config.setValue(config.APPLICATION_SECTION, "log_level", self._log_level)
def load(self) : def runInteractive(self) :
try : try :
self._app.loadModules() self._app.loadModules()
self._app.loadServicesConfigs() self._app.loadServicesConfigs()
...@@ -73,15 +73,14 @@ class Startup(object) : ...@@ -73,15 +73,14 @@ class Startup(object) :
except : except :
logger.error("Initialization error") logger.error("Initialization error")
logger.attachException() logger.attachException()
sys.exit(1) raise
###
def runInteractive(self) :
self.load()
signal.signal(signal.SIGTERM, self.quit) try :
signal.signal(signal.SIGQUIT, self.quit) signal.signal(signal.SIGTERM, self.quit)
signal.signal(signal.SIGQUIT, self.quit)
except :
logger.error("signal() error")
logger.attachException()
try : try :
self._app.runLoop() self._app.runLoop()
...@@ -91,7 +90,7 @@ class Startup(object) : ...@@ -91,7 +90,7 @@ class Startup(object) :
logger.error("Runtime error, trying to close services") logger.error("Runtime error, trying to close services")
logger.attachException() logger.attachException()
self.quit() self.quit()
sys.exit(1) raise
def runDaemon(self) : def runDaemon(self) :
work_dir_path = ( "/" if os.getuid() == 0 else None ) work_dir_path = ( "/" if os.getuid() == 0 else None )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment