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

If supervisor stdout is piped (e.g. through grep), EPIPE is raised during flush; let's not let that cause a traceback.

Chris McDonough пре 17 година
родитељ
комит
77ee98218a
1 измењених фајлова са 6 додато и 1 уклоњено
  1. 6 1
      src/supervisor/loggers.py

+ 6 - 1
src/supervisor/loggers.py

@@ -65,7 +65,12 @@ class Handler:
         self.level = level
 
     def flush(self):
-        self.stream.flush()
+        try:
+            self.stream.flush()
+        except IOError, why:
+            # if supervisor output is piped, this can be raised at exit
+            if why[0] != errno.EPIPE:
+                raise
 
     def close(self):
         self.stream.close()