Преглед изворни кода

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)
             profile('go(options)', globals(), locals(), sort_order, callers)
         else:
         else:
             go(options)
             go(options)
-        if test or (options.mood < SupervisorStates.RESTARTING):
-            break
         options.close_httpservers()
         options.close_httpservers()
         options.close_logger()
         options.close_logger()
         first = False
         first = False
+        if test or (options.mood < SupervisorStates.RESTARTING):
+            break
 
 
 def go(options):
 def go(options):
     d = Supervisor(options)
     d = Supervisor(options)

+ 2 - 0
supervisor/tests/test_supervisord.py

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