Repository navigation
test(pty): call a shell ready when its prompt is printed (refs #58) - #62
Merged
Merged
Conversation
ShortArrow
marked this pull request as ready for review
October 12, 2026 05:07
This was referenced Oct 14, 2026
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.
Refs #58. Follow-up to #61.
Why the prompt is the signal, not a DSR count
#61 waited for a fixed number of cursor-position (DSR) queries: two for pwsh, one for nu. Those counts are not stable. pwsh under
TERM=dumbin the harness's 240x60 window sends one query, before its prompt, so every pwsh PTY test failed atstartupafter 5 s. nu 0.112.2, the version in the CI image, sends two where the code expected one.Every shell does print its default prompt before it reads keys. The harness now waits for the end of that prompt (
$,%,PS /tmp>, or the OSC 133;B mark nu prints where input starts) and then for 100 ms without output. pwsh sends its second query inside that window and the harness answers it. A shell that exits or never prints a prompt now fails atstartup, where #61 had accepted any output from bash or zsh as ready.How it was checked
On WSL Arch with bash 5.3, zsh 5.9, pwsh 7.6.3 and nu 0.114.0, the four PTY test binaries pass. They also pass with pwsh under
TERM=dumb, which failed 2 of 14 tests with #61, and with nu 0.112.2. With 96 busy processes on 32 cores, pwsh passed 30 of 30 runs and bash, zsh and nu 10 of 10 each. With 64 busy processes and nothing else running, pwsh passed 15 of 15. Removing the prompt check, the quiet check or the root prompt from the readiness function each fails at least one of the new tests.