fix(cli): ignore closed readline after stdin#8862
Merged
Jason3S merged 3 commits intoMay 30, 2026
Merged
Conversation
Collaborator
|
Thank you. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a Node 24 regression where cspell lint --file-list stdin can complete processing the stdin-provided file list but then fail with Linter Error: readline was closed. It does this by wrapping the readline async iterator and selectively suppressing the specific post-read “readline was closed” error while still surfacing other errors.
Changes:
- Wrap
readline.createInterface(process.stdin)iteration in an async generator and ignore only thereadline was closederror. - Add unit tests to ensure all lines are preserved when the “closed” error occurs after yielding, and that unrelated errors still throw.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/cspell/src/util/stdin.ts | Wraps stdin readline iteration to swallow the specific post-read “readline was closed” error while rethrowing other errors. |
| packages/cspell/src/util/stdin.test.ts | Adds unit coverage for ignoring the “readline was closed” error after yielding and for rethrowing other readline errors. |
Jason3S
reviewed
May 30, 2026
Signed-off-by: Jason Dent <[email protected]>
Contributor
Performance ReportDaily Performancexychart-beta
title Files Per Second by Day
y-axis Files per Second
x-axis Date [May-4, May-19, May-23, May-24, May-30]
bar [186.25, 187.94, 194.38, 187.53, 186.14]
line [35.07, 33.61, 34.69, 34.94, 35.19]
line [140.01, 135.42, 139.50, 135.65, 127.69]
line [53.38, 53.17, 56.48, 52.20, 56.68]
line [38.18, 20.00, 21.53, 30.85, 22.48]
line [46.04, 43.44, 48.37, 49.79, 45.66]
line [71.11, 69.47, 64.25, 69.53, 69.63]
line [100.08, 77.54, 80.59, 80.29, 82.96]
line [81.26, 84.52, 85.73, 75.59, 76.69]
line [191.37, 176.15, 180.59, 173.73, 189.18]
line [166.55, 126.61, 150.87, 133.44, 132.01]
line [119.17, 123.77, 125.73, 125.94, 125.99]
line [17.95, 22.53, 19.87, 18.72, 19.82]
line [24.56, 24.84, 24.48, 25.27, 24.77]
line [24.93, 21.05, 22.73, 23.64, 23.81]
line [91.75, 92.82, 111.10, 90.94, 91.41]
line [102.79, 98.35, 102.96, 100.96, 102.08]
line [382.99, 374.77, 366.83, 370.08, 362.12]
line [158.32, 153.28, 151.73, 162.52, 158.93]
line [13.72, 16.48, 15.39, 15.58, 14.44]
line [6.46, 6.48, 6.70, 7.10, 5.81]
line [229.32, 234.71, 232.57, 226.13, 298.95]
line [189.78, 185.86, 188.16, 188.58, 184.35]
line [240.52, 257.39, 308.24, 265.00, 276.25]
line [37.38, 45.35, 36.07, 38.42, 36.78]
line [218.55, 254.57, 234.26, 233.79, 228.16]
line [127.00, 147.92, 130.77, 123.22, 129.60]
line [215.39, 212.55, 215.84, 214.38, 208.55]
line [226.51, 267.13, 229.05, 234.58, 243.05]
line [353.58, 346.15, 343.69, 358.26, 363.76]
line [160.29, 160.94, 168.26, 160.60, 161.09]
line [213.17, 213.72, 212.23, 208.69, 218.24]
line [129.13, 127.71, 122.71, 127.15, 121.20]
line [94.12, 93.35, 95.34, 95.32, 94.04]
line [138.03, 140.07, 144.01, 147.15, 147.35]
line [213.15, 208.87, 215.23, 219.43, 204.61]
line [84.38, 85.95, 85.08, 78.77, 81.88]
line [321.24, 319.57, 312.48, 324.31, 317.33]
line [41.81, 48.29, 48.86, 46.46, 60.40]
line [126.81, 116.06, 119.43, 116.84, 113.93]
line [144.52, 126.78, 134.48, 131.99, 150.35]
line [263.11, 260.36, 286.42, 258.60, 256.12]
line [172.93, 177.15, 290.28, 171.42, 175.58]
line [258.73, 266.74, 265.26, 247.18, 231.63]
line [97.37, 104.19, 103.43, 105.92, 105.90]
line [263.28, 254.35, 254.61, 250.00, 254.61]
line [403.25, 398.12, 399.78, 393.93, 406.67]
line [209.84, 213.89, 205.67, 207.63, 212.42]
line [222.86, 217.73, 200.96, 223.84, 227.93]
line [193.68, 201.86, 198.76, 200.08, 197.65]
line [170.59, 170.67, 195.94, 175.36, 167.12]
Time to Process Files
Note:
Files per Second over Time
Data Throughput
|
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.
What changed
Wrap the stdin readline async iterator so CSpell ignores the terminal
readline was closederror that can occur after stdin has already yielded its file list.Other readline errors are still rethrown.
Why
Fixes #8778. On Node 24,
cspell lint --file-list stdincan finish processing a large stdin file list and then reportLinter Error: readline was closedinstead of completing cleanly.Tests
Added unit coverage for:
readline was closedafter readingI could not run the package test command locally in this sandbox because the checkout has no
node_modules, and Corepack is blocked from creating its user cache directory (EPERMunder~/.cache/node/corepack).