From e7d469d97d16739ba7e216cffaef6d4ea24c5d81 Mon Sep 17 00:00:00 2001 From: Josh Karpel Date: Wed, 9 Nov 2022 15:25:39 -0800 Subject: [PATCH 1/2] clear driver exit events after key threads are joined --- src/textual/drivers/linux_driver.py | 1 + src/textual/drivers/windows_driver.py | 1 + 2 files changed, 2 insertions(+) diff --git a/src/textual/drivers/linux_driver.py b/src/textual/drivers/linux_driver.py index f0e75e71ee..9a631cabfb 100644 --- a/src/textual/drivers/linux_driver.py +++ b/src/textual/drivers/linux_driver.py @@ -176,6 +176,7 @@ def disable_input(self) -> None: self.exit_event.set() if self._key_thread is not None: self._key_thread.join() + self.exit_event.clear() termios.tcflush(self.fileno, termios.TCIFLUSH) except Exception as error: # TODO: log this diff --git a/src/textual/drivers/windows_driver.py b/src/textual/drivers/windows_driver.py index b14af7ab58..0899f65ef4 100644 --- a/src/textual/drivers/windows_driver.py +++ b/src/textual/drivers/windows_driver.py @@ -84,6 +84,7 @@ def disable_input(self) -> None: if self._event_thread is not None: self._event_thread.join() self._event_thread = None + self.exit_event.clear() except Exception as error: # TODO: log this pass From 71761f41af4f8c5634b1aa84eb876f415b68409a Mon Sep 17 00:00:00 2001 From: Josh Karpel Date: Wed, 9 Nov 2022 22:04:06 -0600 Subject: [PATCH 2/2] fix if-name-main in linux_driver.py --- src/textual/drivers/linux_driver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/textual/drivers/linux_driver.py b/src/textual/drivers/linux_driver.py index 9a631cabfb..38fcf6e652 100644 --- a/src/textual/drivers/linux_driver.py +++ b/src/textual/drivers/linux_driver.py @@ -250,4 +250,4 @@ class MyApp(App): async def on_mount(self, event: events.Mount) -> None: self.set_timer(5, callback=self._close_messages) - MyApp.run() + MyApp().run()