Don't fire atexit when developing
This commit is contained in:
@@ -1,11 +1,9 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
from os.path import dirname
|
from os.path import dirname
|
||||||
from signal import signal, SIGTERM
|
from signal import signal, SIGTERM
|
||||||
import atexit
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
|
||||||
|
|
||||||
|
|
||||||
# Root path
|
# Root path
|
||||||
@@ -57,11 +55,6 @@ def main():
|
|||||||
|
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
def cleanup():
|
|
||||||
from couchpotato.core.event import fireEvent
|
|
||||||
fireEvent('app.crappy_shutdown', single = True)
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
signal(SIGTERM, lambda signum, stack_frame: sys.exit(1))
|
signal(SIGTERM, lambda signum, stack_frame: sys.exit(1))
|
||||||
@@ -71,5 +64,4 @@ if __name__ == '__main__':
|
|||||||
daemon = Daemon(options.pid_file)
|
daemon = Daemon(options.pid_file)
|
||||||
daemon.daemonize()
|
daemon.daemonize()
|
||||||
|
|
||||||
atexit.register(cleanup)
|
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -5,11 +5,13 @@ from couchpotato.core.event import fireEventAsync, fireEvent
|
|||||||
from couchpotato.core.helpers.variable import getDataDir, tryInt
|
from couchpotato.core.helpers.variable import getDataDir, tryInt
|
||||||
from logging import handlers
|
from logging import handlers
|
||||||
from werkzeug.contrib.cache import FileSystemCache
|
from werkzeug.contrib.cache import FileSystemCache
|
||||||
|
import atexit
|
||||||
import locale
|
import locale
|
||||||
import logging
|
import logging
|
||||||
import os.path
|
import os.path
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
import time
|
||||||
|
|
||||||
def getOptions(base_path, args):
|
def getOptions(base_path, args):
|
||||||
|
|
||||||
@@ -39,6 +41,11 @@ def getOptions(base_path, args):
|
|||||||
return options
|
return options
|
||||||
|
|
||||||
|
|
||||||
|
def cleanup():
|
||||||
|
fireEvent('app.crappy_shutdown', single = True)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
def runCouchPotato(options, base_path, args, desktop = None):
|
def runCouchPotato(options, base_path, args, desktop = None):
|
||||||
|
|
||||||
# Load settings
|
# Load settings
|
||||||
@@ -88,6 +95,9 @@ def runCouchPotato(options, base_path, args, desktop = None):
|
|||||||
debug = options.debug or Env.setting('debug', default = False, type = 'bool')
|
debug = options.debug or Env.setting('debug', default = False, type = 'bool')
|
||||||
Env.set('debug', debug)
|
Env.set('debug', debug)
|
||||||
|
|
||||||
|
if not Env.setting('development'):
|
||||||
|
atexit.register(cleanup)
|
||||||
|
|
||||||
# Disable server access log
|
# Disable server access log
|
||||||
server_log = logging.getLogger('werkzeug')
|
server_log = logging.getLogger('werkzeug')
|
||||||
server_log.disabled = True
|
server_log.disabled = True
|
||||||
|
|||||||
Reference in New Issue
Block a user