瀏覽代碼

Close loggers and HTTP servers before exiting on shutdown

Mike Naberezny 10 年之前
父節點
當前提交
edd4a734fd
共有 2 個文件被更改,包括 4 次插入2 次删除
  1. 2 2
      supervisor/supervisord.py
  2. 2 0
      supervisor/tests/test_supervisord.py

+ 2 - 2
supervisor/supervisord.py

@@ -364,11 +364,11 @@ def main(args=None, test=False):
             profile('go(options)', globals(), locals(), sort_order, callers)
         else:
             go(options)
-        if test or (options.mood < SupervisorStates.RESTARTING):
-            break
         options.close_httpservers()
         options.close_logger()
         first = False
+        if test or (options.mood < SupervisorStates.RESTARTING):
+            break
 
 def go(options):
     d = Supervisor(options)

+ 2 - 0
supervisor/tests/test_supervisord.py

@@ -28,6 +28,7 @@ class EntryPointTests(unittest.TestCase):
             'donothing.conf')
         import StringIO
         new_stdout = StringIO.StringIO()
+        new_stdout.fileno = lambda: 1
         old_stdout = sys.stdout
         try:
             tempdir = tempfile.mkdtemp()
@@ -50,6 +51,7 @@ class EntryPointTests(unittest.TestCase):
                 'donothing.conf')
             import StringIO
             new_stdout = StringIO.StringIO()
+            new_stdout.fileno = lambda: 1
             old_stdout = sys.stdout
             try:
                 tempdir = tempfile.mkdtemp()