mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
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: https://github.com/nodejs/node/issues/21203 PR-URL: https://github.com/nodejs/node/pull/21654 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
6acb55041b
commit
91eec00ca2
5 files changed
+38
-1
No files matched your search
@@ -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'
|
||||
}));
|
||||
Whitespace-only changes.
Reference in new issue
Block a user