Skip to content

doc: setRawMode needs write permission on Windows#63856

Open
edemaine wants to merge 1 commit into
nodejs:mainfrom
edemaine:tty-rw
Open

doc: setRawMode needs write permission on Windows#63856
edemaine wants to merge 1 commit into
nodejs:mainfrom
edemaine:tty-rw

Conversation

@edemaine

@edemaine edemaine commented Jun 11, 2026

Copy link
Copy Markdown

Fixes #63852. After reporting that issue, I realized that this is probably how Windows is supposed to work, and I just needed to open the console with better permissions. This PR documents this solution so that others can figure this out more easily.

Summary of changes

Document that tty.ReadStream#setRawMode() on Windows requires write access to the console input buffer.

When opening "\\\\.\\CONIN$" with the fs.open() family of APIs, a read-only flag such as 'r' allows creating a readable TTY stream, but setRawMode() fails because Windows needs write permission to update the console mode. Recommend using a read/write flag such as 'r+'.

Fixes: nodejs#63852
Signed-off-by: Erik Demaine <edemaine@mit.edu>
@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. tty Issues and PRs related to the tty subsystem. labels Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Issues and PRs related to the documentations. tty Issues and PRs related to the tty subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: no supported way to reopen console input (CONIN$) as a raw tty.ReadStream when stdin is a pipe

2 participants