diff --git a/tests/integration/files/log_handlers/runtests_log_handler.py b/tests/integration/files/log_handlers/runtests_log_handler.py index c27599ffd9..9b8e82cfb9 100644 --- a/tests/integration/files/log_handlers/runtests_log_handler.py +++ b/tests/integration/files/log_handlers/runtests_log_handler.py @@ -97,8 +97,11 @@ def process_queue(port, queue): # logging handlers sock.sendall(msgpack.dumps(record.__dict__, encoding='utf-8')) except (IOError, EOFError, KeyboardInterrupt, SystemExit): - sock.shutdown(socket.SHUT_RDWR) - sock.close() + try: + sock.shutdown(socket.SHUT_RDWR) + sock.close() + except (OSError, socket.error): + pass break except socket.error as exc: if exc.errno == errno.EPIPE: @@ -106,7 +109,7 @@ def process_queue(port, queue): try: sock.shutdown(socket.SHUT_RDWR) sock.close() - except OSError: + except (OSError, socket.error): pass break log.exception(exc)