Skip to content

Commit

Permalink
Ignore harmless KeyError while modifying selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Feb 9, 2018
1 parent 8c18486 commit e119ed0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions kittens/tui/loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,15 @@ def wakeup(self):

def _modify_output_selector(self, waiting_for_write):
if waiting_for_write:
self.sel.register(self.output_fd, selectors.EVENT_WRITE, self._write_ready)
try:
self.sel.register(self.output_fd, selectors.EVENT_WRITE, self._write_ready)
except KeyError:
pass
else:
self.sel.unregister(self.output_fd)
try:
self.sel.unregister(self.output_fd)
except KeyError:
pass

def loop(self, handler):
select = self.sel.select
Expand Down

0 comments on commit e119ed0

Please sign in to comment.