Skip to content

test(pty): pin that a return reaches a slow shell as CR (refs #58) - #63

Merged
ShortArrow merged 3 commits into
mainfrom
test/pty-cr-reaches-slow-shell
Oct 20, 2026
Merged

ShortArrow merged 3 commits into
mainfrom
test/pty-cr-reaches-slow-shell

Conversation

@ShortArrow

@ShortArrow ShortArrow commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

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. After settle_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.

@ShortArrow
ShortArrow merged commit 0d05116 into main Oct 20, 2026
7 checks passed
@ShortArrow
ShortArrow deleted the test/pty-cr-reaches-slow-shell branch October 20, 2026 06:42
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