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