GeezerVison is showing github.com — tty: add raw-vt and io raw modes by samuel-williams-shopify · Pull Request #64140 · nodejs/node
Conversation
Adds string raw-mode selection to tty.ReadStream#setRawMode():
setRawMode(true) keeps the existing behavior.
setRawMode('raw') explicitly selects the existing Node raw mode, backed by libuv UV_TTY_MODE_RAW_VT.
setRawMode('io') selects libuv UV_TTY_MODE_IO for binary-safe I/O mode on Unix.
readStream.rawMode exposes the exact current mode while readStream.isRaw remains boolean for compatibility.
- Unknown string modes are rejected.
This is intended to address the output-processing distinction discussed in #63059 and follows libuv's existing UV_TTY_MODE_IO semantics. It preserves the current setRawMode(true) behavior instead of changing it.
Related libuv hardening PR: libuv/libuv#5174
Refs: #63059
Refs: libuv/libuv#32
Local verification:
git diff --check passes.
- A full local build could not complete because macOS killed Cargo
build-script-build executables as untrusted on this machine; relying on CI for the native build and pseudo-tty test run.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
raw device. If `false`, configures the `tty.ReadStream` to operate in its
|
|
|
default mode. The `readStream.isRaw` property will be set to the resulting
|
|
|
mode.
|
|
|
* `mode` {boolean|string} If `true` or `'raw-vt'`, configures the
|
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.
I would not use 'raw-vt' as a name and instead just use 'raw'. UV_TTY_MODE_RAW_VT is what UV_TTY_MODE_RAW should probably have been all along – the only reason they aren't merged (yet) into a single constant is backwards compatibility expectations in libuv.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
Related libuv hardening PR: libuv/libuv#5174
That PR makes Unix uv_tty_set_mode() return UV_EINVAL for unrecognized uv_tty_mode_t values, matching the existing Windows behavior.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
addaleax
added
author ready
PRs with CI started, the required approvals, and no outstanding review comments.
request-ci
Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review.
labels
Jun 30, 2026
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I can't see the CI failures, it says access denied.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@samuel-williams-shopify The failures seem exclusively related to alpine:
...
length differs.
expect=4
actual=7
patterns:
pattern = ^raw=true$
pattern = ^normal=false$
pattern = ^raw\-string=true$
pattern = ^io=false$
outlines:
outline = stty: standard input: Not a tty
outline = raw=true
outline = normal=false
outline = stty: standard input: Not a tty
outline = raw-string=true
outline = stty: standard input: Not a tty
outline = io=false
not ok 5141 pseudo-tty/test-set-raw-mode-modes
---
duration_ms: 287.86900
severity: fail
stack: |-
stty: standard input: Not a tty
raw=true
normal=false
stty: standard input: Not a tty
raw-string=true
stty: standard input: Not a tty
io=false
...
Not sure what's different on the Alpine runners, I guess if there's no obvious reason for this it might be fine to silence stderr for stty instead of specifying inherit there
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Pushed a test-only update in 7af5c59 to capture stty stderr in test-set-raw-mode-modes instead of inheriting it. This should prevent Alpine's stty: standard input: Not a tty message from polluting the pseudo-tty expected-output comparison while still surfacing stderr if stty exits non-zero.
I can't trigger or view the Jenkins run from here, and the new GitHub checks appear to be waiting for maintainer approval. Could a maintainer approve/rerun CI when convenient?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
This PR needs to a rebase to resolve conflicts in doc/api/tty.md
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as resolved.
codecov
Bot
commented
Aug 22, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
❌ Patch coverage is 97.05882% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.11%. Comparing base (9472421) to head (f94af6e).
⚠️ Report is 64 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #64140 +/- ##
==========================================
- Coverage 90.12% 90.11% -0.02%
==========================================
Files 752 752
Lines 252312 252338 +26
Branches 47432 47444 +12
==========================================
- Hits 227404 227398 -6
- Misses 16217 16265 +48
+ Partials 8691 8675 -16
... and 32 files with indirect coverage changes
🚀 New features to boost your workflow:
- ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Commit Queue failed
This pull request has multiple commits, but no landing policy was selected.
Add
commit-queue-squash
PRs the Commit Queue should land as one squashed commit.
to land it as one commit, or
commit-queue-rebase
PRs the Commit Queue should land as multiple self-contained commits.
to land the commits separately.
The pull request was removed from the Commit Queue and labeled
commit-queue-failed
PRs whose Commit Queue landing failed and need manual intervention before retrying.
. After resolving the failure, remove that label and add
commit-queue
PRs queued for automated landing through the Commit Queue.
to retry.
Full Commit Queue output
- Loading data for nodejs/node/pull/64140
✔ Done loading data for nodejs/node/pull/64140
----------------------------------- PR info ------------------------------------
Title tty: add raw-vt and io raw modes (#64140)
Author Samuel Williams <[email protected]> (@samuel-williams-shopify, first-time contributor)
Branch samuel-williams-shopify:tty-raw-vt-io-mode -> nodejs:main
Labels c++, tty, author ready, needs-ci, commit-queue
Commits 5
- tty: add raw-vt and io raw modes
- doc: update tty raw mode PR-URL
- tty: use raw as public raw mode name
- tty: reject unknown raw mode strings
- test: silence stty stderr in raw mode test
Committers 1
- Samuel Williams <[email protected]>
PR-URL: https://github.com/nodejs/node/pull/64140
Refs: https://github.com/nodejs/node/issues/63059
Refs: https://github.com/libuv/libuv/issues/32
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/64140
Refs: https://github.com/nodejs/node/issues/63059
Refs: https://github.com/libuv/libuv/issues/32
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
--------------------------------------------------------------------------------
ℹ This PR was created on Fri, 26 Jun 2026 04:05:37 GMT
✔ Approvals: 3
✔ - Anna Henningsen (@addaleax): https://github.com/nodejs/node/pull/64140#pullrequestreview-4599153146
✔ - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/64140#pullrequestreview-4629888278
✔ - Trivikram Kamat (@trivikr): https://github.com/nodejs/node/pull/64140#pullrequestreview-5000667735
✔ Last GitHub CI successful
ℹ Last Full PR CI on 2026-08-23T05:18:11Z: https://ci.nodejs.org/job/node-test-pull-request/76273/
- Querying data for job/node-test-pull-request/76273/
✔ Build data downloaded
✔ Last Jenkins CI successful
--------------------------------------------------------------------------------
✔ No git cherry-pick in progress
✔ No git am in progress
✔ No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/main up to date...
From https://github.com/nodejs/node
* branch main -> FETCH_HEAD
7072d76a5c..a89fc17cce main -> origin/main
✔ origin/main is now up-to-date
main is out of sync with origin/main. Mismatched commits:
- fe654d1a54 stream: reuse unexposed managed read buffers
- a89fc17cce stream: reuse unexposed managed read buffers
--------------------------------------------------------------------------------
HEAD is now at a89fc17cce stream: reuse unexposed managed read buffers
✔ Reset to origin/main
- Downloading patch for 64140
From https://github.com/nodejs/node
* branch refs/pull/64140/merge -> FETCH_HEAD
✔ Fetched commits as eae0ca39be9c..f94af6ec6e76
--------------------------------------------------------------------------------
[main 6ebb60c5ec] tty: add raw-vt and io raw modes
Author: Samuel Williams <[email protected]>
Date: Fri Jun 26 16:05:18 2026 +1200
5 files changed, 92 insertions(+), 12 deletions(-)
create mode 100644 test/pseudo-tty/test-set-raw-mode-modes.js
create mode 100644 test/pseudo-tty/test-set-raw-mode-modes.out
[main 18f60e82d3] doc: update tty raw mode PR-URL
Author: Samuel Williams <[email protected]>
Date: Tue Jun 30 11:38:26 2026 +1200
1 file changed, 1 insertion(+), 1 deletion(-)
[main cd13331424] tty: use raw as public raw mode name
Author: Samuel Williams <[email protected]>
Date: Tue Jun 30 11:38:39 2026 +1200
4 files changed, 11 insertions(+), 11 deletions(-)
[main d68dc705ab] tty: reject unknown raw mode strings
Author: Samuel Williams <[email protected]>
Date: Tue Jun 30 11:39:07 2026 +1200
2 files changed, 17 insertions(+), 1 deletion(-)
[main 347777f3e0] test: silence stty stderr in raw mode test
Author: Samuel Williams <[email protected]>
Date: Fri Jul 3 21:24:20 2026 +1200
1 file changed, 3 insertions(+), 3 deletions(-)
✔ Patches applied
There are 5 commits in the PR. Attempting autorebase.
(node:1323) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated.
(Use `node --trace-deprecation ...` to show where the warning was created)
Rebasing (2/10)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
tty: add raw-vt and io raw modes
Signed-off-by: Samuel Williams <[email protected]>
PR-URL: https://github.com/nodejs/node/pull/64140
Refs: https://github.com/nodejs/node/issues/63059
Refs: https://github.com/libuv/libuv/issues/32
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
--------------------------------------------------------------------------------
[detached HEAD 9062b86765] tty: add raw-vt and io raw modes
Author: Samuel Williams <[email protected]>
Date: Fri Jun 26 16:05:18 2026 +1200
5 files changed, 92 insertions(+), 12 deletions(-)
create mode 100644 test/pseudo-tty/test-set-raw-mode-modes.js
create mode 100644 test/pseudo-tty/test-set-raw-mode-modes.out
Rebasing (3/10)
Rebasing (4/10)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
doc: update tty raw mode PR-URL
Signed-off-by: Samuel Williams <[email protected]>
PR-URL: https://github.com/nodejs/node/pull/64140
Refs: https://github.com/nodejs/node/issues/63059
Refs: https://github.com/libuv/libuv/issues/32
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
--------------------------------------------------------------------------------
[detached HEAD c899fb3810] doc: update tty raw mode PR-URL
Author: Samuel Williams <[email protected]>
Date: Tue Jun 30 11:38:26 2026 +1200
1 file changed, 1 insertion(+), 1 deletion(-)
Rebasing (5/10)
Rebasing (6/10)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
tty: use raw as public raw mode name
Signed-off-by: Samuel Williams <[email protected]>
PR-URL: https://github.com/nodejs/node/pull/64140
Refs: https://github.com/nodejs/node/issues/63059
Refs: https://github.com/libuv/libuv/issues/32
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
--------------------------------------------------------------------------------
[detached HEAD b0d51a9df8] tty: use raw as public raw mode name
Author: Samuel Williams <[email protected]>
Date: Tue Jun 30 11:38:39 2026 +1200
4 files changed, 11 insertions(+), 11 deletions(-)
Rebasing (7/10)
Rebasing (8/10)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
tty: reject unknown raw mode strings
Signed-off-by: Samuel Williams <[email protected]>
PR-URL: https://github.com/nodejs/node/pull/64140
Refs: https://github.com/nodejs/node/issues/63059
Refs: https://github.com/libuv/libuv/issues/32
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
--------------------------------------------------------------------------------
[detached HEAD 994d15e30a] tty: reject unknown raw mode strings
Author: Samuel Williams <[email protected]>
Date: Tue Jun 30 11:39:07 2026 +1200
2 files changed, 17 insertions(+), 1 deletion(-)
Rebasing (9/10)
Rebasing (10/10)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
test: silence stty stderr in raw mode test
Signed-off-by: Samuel Williams <[email protected]>
PR-URL: https://github.com/nodejs/node/pull/64140
Refs: https://github.com/nodejs/node/issues/63059
Refs: https://github.com/libuv/libuv/issues/32
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
--------------------------------------------------------------------------------
[detached HEAD 9894a86a37] test: silence stty stderr in raw mode test
Author: Samuel Williams <[email protected]>
Date: Fri Jul 3 21:24:20 2026 +1200
1 file changed, 3 insertions(+), 3 deletions(-)
Successfully rebased and updated refs/heads/main.
--------------------------------------------------------------------------------
ℹ Add `commit-queue-squash` label to land the PR as one commit, or `commit-queue-rebase` to land as separate commits.
View workflow run
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
samuel-williams-shopify reacted with hooray emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
robobun
added a commit
to oven-sh/bun
that referenced
this pull request
Oct 29, 2026
… Node v26.8
tty.ReadStream#setRawMode(mode) classifies `mode` as Node's lib/tty.js
does since v26.8.0 and v24.21.0 (nodejs/node#64140). 'raw' and 'io'
select a mode. Any other string throws ERR_INVALID_ARG_VALUE before the
stream is touched. Every other value goes by its truthiness. The stream
reports its mode in `rawMode`: false, 'raw' or 'io'.
'io' is libuv's UV_TTY_MODE_IO: cfmakeraw(), which also turns output
processing off. The POSIX setter already had that mode. libuv has no
such mode on Windows, so there the stream emits 'error' with ENOTSUP.
The POSIX setter folds UV_TTY_MODE_RAW_VT into UV_TTY_MODE_RAW, as
libuv does, and refuses a mode that is none of libuv's with EINVAL.
process.binding('tty_wrap') has UV_TTY_MODE_NORMAL, UV_TTY_MODE_IO and
UV_TTY_MODE_RAW_VT, and TTY#setRawMode takes its argument with ToInt32.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
author ready
PRs with CI started, the required approvals, and no outstanding review comments.
c++
Issues and PRs that require attention from people who are familiar with C++.
commit-queue-squash
PRs the Commit Queue should land as one squashed commit.
needs-ci
PRs that need a full CI run.
tty
Issues and PRs related to the tty subsystem.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|