unix: return EINVAL for invalid tty modes#5174
Merged
santigimeno merged 2 commits intoJun 30, 2026
Merged
Conversation
Contributor
Author
|
Related Node.js API PR: nodejs/node#64140 That PR exposes Node's existing raw mode and libuv |
Signed-off-by: Samuel Williams <[email protected]>
samuel-williams-shopify
force-pushed
the
unix-tty-invalid-mode-einval
branch
from
June 29, 2026 23:49
8c50f83 to
256d7dd
Compare
Signed-off-by: Samuel Williams <[email protected]>
saghul
approved these changes
Jun 30, 2026
addaleax
approved these changes
Jun 30, 2026
santigimeno
approved these changes
Jun 30, 2026
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.
Make the Unix
uv_tty_set_mode()implementation returnUV_EINVALfor unrecognizeduv_tty_mode_tvalues instead of reachingUNREACHABLE().The Windows implementation already returns
UV_EINVALfor invalid TTY modes, so this makes the behavior consistent across platforms and avoids treating caller-provided enum values as unreachable state.Validation is performed before raw-mode normalization so invalid modes do not touch terminal state.
Refs: nodejs/node#64140
Local verification:
tty_ptypassed locally.ttyskipped locally because this environment has no controlling/dev/tty.