Skip to content

Commit

Permalink
tty: enable buffering
Browse files Browse the repository at this point in the history
HWM was set to 0 which would cause e.g. stdout.write(...) to
always return false.

Refs: #39246

PR-URL: #39253
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
  • Loading branch information
ronag committed Jul 7, 2021
1 parent 9b68d84 commit a8a8638
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/tty.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function ReadStream(fd, options) {
}

net.Socket.call(this, {
highWaterMark: 0,
readableHighWaterMark: 0,
handle: tty,
manualStart: true,
...options
Expand Down Expand Up @@ -94,7 +94,7 @@ function WriteStream(fd) {
}

net.Socket.call(this, {
highWaterMark: 0,
readableHighWaterMark: 0,
handle: tty,
manualStart: true
});
Expand Down
8 changes: 8 additions & 0 deletions test/parallel/test-stdout-stderr-write.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

require('../common');
const assert = require('assert');

// https://github.com/nodejs/node/pull/39246
assert.strictEqual(process.stderr.write('asd'), true);
assert.strictEqual(process.stdout.write('asd'), true);

0 comments on commit a8a8638

Please sign in to comment.