-
Notifications
You must be signed in to change notification settings - Fork 814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression in Textual 0.48 when executing app in a subprocess #4104
Comments
Bisected to this commit:
|
Looks like this call: 374478a#diff-13d6e180136893233a19e971fc665690e6afb9ed7b807311884ab961f1db25f2R157-R159 is making the process hang. Seems that |
Thanks. Will look at that soon. |
I did some extra debugging, it's not hanging in
|
I think this logic is flawed: textual/src/textual/drivers/linux_driver.py Lines 173 to 176 in 8ae0b27
Here, it's clear that |
That, however, then breaks the handling of being suspended and attempts to Excellent spot though, thanks for narrowing this down. For a bit of background, so I can create a wee test to juggle the competing needs: you're running a Textual application in an automated way, in a subprocess? Is it the case that the display itself isn't needed? (just randomly wondering if this sort of thing should be going via the headless driver, for example). |
Right but this problem highlights that that logic is assuming that the only situation for
Yes, for testing purposes. See the link in the first comment as reference
We parse the output from the subprocess, but we do not need to "see" it for this tests. |
Yup, got that, I was just making a note for the issue in general that the change you mentioned has a (intended) consequence; just making notes. Amusingly I was just looking at handling it with some use of |
@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 |
Awesome, thanks, and that also works as intended when handling suspending, |
Fixes Textualize#4104 Co-authored-by: Pablo Galindo <[email protected]>
Thanks a lot for the help! ❤️ |
Back at you; helpfully detailed and easily tested report. Really appreciate it. |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
Fixed in 0.48.2, just released |
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
The text was updated successfully, but these errors were encountered: