Преглед на файлове

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()