Skip to content

test(pty): call a shell ready when its prompt is printed (refs #58) - #62

Merged
ShortArrow merged 2 commits into
mainfrom
test/pty-ready-on-prompt
Oct 12, 2026
Merged

ShortArrow merged 2 commits into
mainfrom
test/pty-ready-on-prompt

Conversation

@ShortArrow

@ShortArrow ShortArrow commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

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=dumb in the harness's 240x60 window sends one query, before its prompt, so every pwsh PTY test failed at startup after 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 at startup, 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.

@ShortArrow
ShortArrow marked this pull request as ready for review October 12, 2026 05:07
@ShortArrow
ShortArrow merged commit 7c822db into main Oct 12, 2026
7 checks passed
@ShortArrow
ShortArrow deleted the test/pty-ready-on-prompt branch October 12, 2026 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant