summaryrefslogtreecommitdiff
path: root/lib/tty.js
diff options
context:
space:
mode:
authorRobert Nagy <ronagy@icloud.com>2020-07-15 21:44:10 +0200
committerRobert Nagy <ronagy@icloud.com>2021-07-02 22:11:16 +0200
commit954217adda03457115e426e9126dcad845877f74 (patch)
tree5f278968722de533049e71296c9e0859e5dcc2c2 /lib/tty.js
parent1544e69b93565c97e7ed232bf2db237d34b8fd7c (diff)
downloadnode-new-954217adda03457115e426e9126dcad845877f74.tar.gz
stream: error Duplex write/read if not writable/readable
If writable/readable has been explicitly disabled then using a Duplex as writable/readable should fail. Fixes: https://github.com/nodejs/node/issues/34374 PR-URL: https://github.com/nodejs/node/pull/34385 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'lib/tty.js')
-rw-r--r--lib/tty.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/tty.js b/lib/tty.js
index e61a5c3ac3..d9c576b5fd 100644
--- a/lib/tty.js
+++ b/lib/tty.js
@@ -51,16 +51,15 @@ function ReadStream(fd, options) {
throw new ERR_INVALID_FD(fd);
const ctx = {};
- const tty = new TTY(fd, true, ctx);
+ const tty = new TTY(fd, ctx);
if (ctx.code !== undefined) {
throw new ERR_TTY_INIT_FAILED(ctx);
}
net.Socket.call(this, {
highWaterMark: 0,
- readable: true,
- writable: false,
handle: tty,
+ manualStart: true,
...options
});
@@ -89,15 +88,15 @@ function WriteStream(fd) {
throw new ERR_INVALID_FD(fd);
const ctx = {};
- const tty = new TTY(fd, false, ctx);
+ const tty = new TTY(fd, ctx);
if (ctx.code !== undefined) {
throw new ERR_TTY_INIT_FAILED(ctx);
}
net.Socket.call(this, {
+ highWaterMark: 0,
handle: tty,
- readable: false,
- writable: true
+ manualStart: true
});
// Prevents interleaved or dropped stdout/stderr output for terminals.