Repository navigation
test(pty): pin that a return reaches a slow shell as CR (refs #58) - #63
Merged
Merged
Conversation
…ell as CR (refs #58)
ShortArrow
marked this pull request as ready for review
October 14, 2026 07:12
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.
What the new test pins
A line typed while the PTY is still in canonical mode has its CR turned into LF by the line discipline's ICRNL. pwsh keeps those bytes when it switches to raw mode, and PSReadLine renders an LF-terminated line without running it. That is how a fixed startup wait failed on a slow macOS runner, and #62's wait for the prompt avoids it because pwsh leaves canonical mode before it prints the prompt.
The test starts a stand-in shell that behaves like pwsh: it prints a terminal mode sequence, leaves canonical mode 800 ms after its first output, then prints
$and reports the byte it reads. Aftersettle_startup, a typed return must arrive as\r. The test fails if the startup wait is a fixed 600 ms, or if it accepts any output followed by 100 ms of quiet as #61 did for bash; in both cases the shell reads\n.Cost
The test lives in the shared PTY harness, so it runs in each of the four PTY test binaries. It takes about 0.95 s and runs in parallel with the other tests in its binary, so a binary gets longer only by the amount its own tests finish sooner. In one CI run on the Linux runner, compared with main, bash grew by 0.7 s, zsh by 0.6 s, nu by 0.5 s and pwsh by 0.1 s.