diff --git a/kitty/remote_control.py b/kitty/remote_control.py index 1ed56ec0f..bc12f0d18 100644 --- a/kitty/remote_control.py +++ b/kitty/remote_control.py @@ -58,7 +58,10 @@ class SocketIO: def __exit__(self, *a): import socket - self.socket.shutdown(socket.SHUT_RDWR) + try: + self.socket.shutdown(socket.SHUT_RDWR) + except EnvironmentError: + pass # on some OSes such as macOS the socket is already closed at this point self.socket.close() def send(self, data):