From b0e599dc6837868406d2318e97aa0aecbdffbccd Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Fri, 3 Jun 2022 01:45:45 +0100 Subject: [PATCH] Catch broken pipe error --- dockstat.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dockstat.py b/dockstat.py index d5e82ba..0786610 100644 --- a/dockstat.py +++ b/dockstat.py @@ -61,7 +61,10 @@ class HTTPHandler(MetricsHandler): # type: ignore[misc] """ self.send_response(int(status) or 500) self.end_headers() - self.wfile.write(bytes(str(message).encode())) + try: + self.wfile.write(bytes(str(message).encode())) + except BrokenPipeError: + pass def _metrics(self) -> None: """