textual: Regression in Textual 0.48 when executing app in a subprocess

In the memray project we have several tests that execute textual in a subprocess and drives them by passing input. For example:

https://github.com/bloomberg/memray/blob/cc5463a4c4fca83b53a48331501e1753a78e39ca/tests/integration/test_main.py#L853-L874

Since yesterday’s release of Textual 0.48 all of these test hang and our test suite is frozen. It looks like the app ignores the input that we are passing via input="q". I can confirm that all these test work with textual<0.48.

Unfortunately this is blocking memray’s CI right now

About this issue

  • Original URL
  • State: closed
  • Created 5 months ago
  • Comments: 16 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Fixed in 0.48.2, just released

Thanks a lot for the help! ❤️

@pablogsal I don’t have anything to hand similar to what you’e doing (I’ll try and make an MRE, unless you have one), but if you’re in a position to, just as a quick test, presumably something akin to this:

diff --git a/src/textual/drivers/linux_driver.py b/src/textual/drivers/linux_driver.py
index 7f33082d..9cadc5c0 100644
--- a/src/textual/drivers/linux_driver.py
+++ b/src/textual/drivers/linux_driver.py
@@ -167,9 +167,10 @@ class LinuxDriver(Driver):
             # output; so rather than get into the business of spinning up
             # application mode again and then finding out, we perform a
             # no-consequence change and detect the problem right away.
-            termios.tcsetattr(
-                self.fileno, termios.TCSANOW, termios.tcgetattr(self.fileno)
-            )
+            if os.isatty(self.fileno):
+                termios.tcsetattr(
+                    self.fileno, termios.TCSANOW, termios.tcgetattr(self.fileno)
+                )
         except termios.error:
             # There was an error doing the tcsetattr; there is no sense in
             # carrying on because we'll be doing a SIGSTOP (see above).

If you’re in a position to give that or similar a spin I’d be curious to hear how it goes.

I can confirm that this also fixes the problem