Repository navigation
fix: stop test scripts from inheriting the terminal - #336
Open
bananaplain wants to merge 1 commit into
Open
bananaplain wants to merge 1 commit into
bananaplain wants to merge 1 commit into
Conversation
Scripts inherited the TUI's terminal as stdin, so a tool like flutter could switch it back to line mode with echo on exit. Mouse events then printed as raw escape codes and shortcuts stopped working.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Any command in a test script can change the settings of the terminal the TUI runs on, because the script inherits it. flutter is one example: when it exits, it turns line mode and echo back on. Usually that would be an example of a command "playing nice", but in this case it breaks our TUI.
After a flutter command runs, the TUI is broken:
mouse movement prints as raw escape codes (
^[[<35;2;16M…)shortcuts stop working
The render itself carries on as normal and the TUI keeps being redrawn.
Fix
Start test scripts with an empty stdin (/dev/null). stdout and stderr were already redirected into a pipe, so stdin was the only one still connected to the terminal:
NOTE⚠️
If a test script happens to run
docker run -t/docker exec -itit will now fail with "the input device is not a TTY". This can be fixed by dropping the -t. A quick sweep of codeplain repos didn't find such a script, but it would already have failed whenever a codeplain render was started without a terminal on stdin, e.g. in headless mode.Summary by CodeRabbit