forked from nodejs/node
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tty: make _read throw ERR_TTY_WRITABLE_NOT_READABLE
This change avoid an 'read ENOTCONN' error introduced by libuv 1.20.0 when trying to read from a TTY WriteStream. Instead, we are throwing a more actionable ERR_TTY_WRITABLE_NOT_READABLE. Fixes: nodejs#21203
- Loading branch information
Showing
5 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const { WriteStream } = require('tty'); | ||
const fd = common.getTTYfd(); | ||
|
||
// Calling resume on a tty.WriteStream should be a no-op | ||
// Ref: https://github.com/nodejs/node/issues/21203 | ||
|
||
const stream = new WriteStream(fd); | ||
stream.resume(); | ||
|
||
stream.on('error', common.expectsError({ | ||
code: 'ERR_TTY_WRITABLE_NOT_READABLE', | ||
type: Error, | ||
message: 'The Writable side of a TTY is not Readable' | ||
})); |
Empty file.