-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
fix(create-docusaurus): avoid stdin race condition on Windows #11652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
For some reason, with the same changes and rebuilding, the issue wasn't fixed on my end. Probably because I wasn't able to rebuild properly. |
|
Thanks for checking this ! Just to clarify the local testing steps I used, since this change won’t After applying the patch, I rebuilt the local package and ran the CLI
(or
node packages/create-docusaurus/bin/index.js my-test-siteThis ensures the test runs against the locally modified CLI code. Using Let me know if following these steps still reproduces the issue on your |
Yeah, if I give the site name argument, the issue doesn't occur, otherwise it does. |
|
yeah,got it . when a site name is passed as an argument, the When no site name is provided, This PR removes one source of concurrent stdin access, but there may be |
| readTemplates(), | ||
| getSiteName(reqName, rootDir), | ||
| ]); | ||
| const templates = await readTemplates(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you help me understand where is the stdin access within the readTemplates method? I don't see any 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while i tried to debug myself, ai tried to convince me that, refactoring these lines will fix the issue. i was very naive and newbie to believe that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify what this change does solve :
Even though readTemplates() itself doesn’t access stdin, running it in parallel with getSiteName() changes the overall execution timing of the CLI startup. Making these steps sequential removes one source of concurrent work during the very early prompt initialization phase.
In my local testing on Windows, this reduced the likelihood of the terminal losing keyboard focus during the initial prompts, especially around template/language selection.
That said, I agree this doesn’t fully explain or eliminate all stdin issues - particularly when the site name prompt is active - so this change likely improves part of the behavior rather than addressing the entire root cause.
Pre-flight checklist
Motivation
This PR fixes a Windows-only issue where interactive CLI prompts lose
keyboard focus during
create-docusaurusinitialization.The problem was caused by running
readTemplates()andgetSiteName()concurrently using
Promise.all(). On Windows terminals, concurrentstdin access can cause arrow key input to be ignored until Enter is
pressed.
Test Plan
Since
pnpm create docusauruspulls the published package from theregistry, it does not reflect local source changes.
To test the fix locally:
node bin/index.json Windows 11 without requiring an extra Enter key press
This approach ensures the test runs against the locally modified CLI implementation.
Test links
N/A (CLI-only change, no UI impact)
Related issues/PRs
Fixes #11651