From 82529d88f022dd2b1073c4ab4a6b4a9d3894c66e Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Mon, 11 Oct 2021 18:27:39 +0200 Subject: [PATCH] windows: fix file editing tornado's asnycio patch does not take nonexisting file descriptors very well, so we need to catch errors here. --- mitmproxy/contrib/urwid/raw_display.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mitmproxy/contrib/urwid/raw_display.py b/mitmproxy/contrib/urwid/raw_display.py index b2a56b4a1..ee6d30bdf 100644 --- a/mitmproxy/contrib/urwid/raw_display.py +++ b/mitmproxy/contrib/urwid/raw_display.py @@ -444,7 +444,10 @@ class Screen(BaseScreen, RealTerminal): self._input_thread = None for handle in self._current_event_loop_handles: - event_loop.remove_watch_file(handle) + try: + event_loop.remove_watch_file(handle) + except KeyError: + pass if self._input_timeout: event_loop.remove_alarm(self._input_timeout)