Skip to content

Commit a4e4e48

Browse files
committed
Revert "tty: make _read throw ERR_TTY_WRITABLE_NOT_READABLE"
This reverts commit 91eec00. Refs: nodejs#21654 Refs: nodejs#21203
1 parent 4da11f2 commit a4e4e48

File tree

5 files changed

+1
-38
lines changed

5 files changed

+1
-38
lines changed

doc/api/errors.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,12 +1713,6 @@ A `Transform` stream finished with data still in the write buffer.
17131713

17141714
The initialization of a TTY failed due to a system error.
17151715

1716-
<a id="ERR_TTY_WRITABLE_NOT_READABLE"></a>
1717-
### ERR_TTY_WRITABLE_NOT_READABLE
1718-
1719-
This `Error` is thrown when a read is attempted on a TTY `WriteStream`,
1720-
such as `process.stdout.on('data')`.
1721-
17221716
<a id="ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET"></a>
17231717
### ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET
17241718

lib/internal/errors.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -846,9 +846,6 @@ E('ERR_TRANSFORM_ALREADY_TRANSFORMING',
846846
E('ERR_TRANSFORM_WITH_LENGTH_0',
847847
'Calling transform done when writableState.length != 0', Error);
848848
E('ERR_TTY_INIT_FAILED', 'TTY initialization failed', SystemError);
849-
E('ERR_TTY_WRITABLE_NOT_READABLE',
850-
'The Writable side of a TTY is not Readable',
851-
Error);
852849
E('ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET',
853850
'`process.setupUncaughtExceptionCapture()` was called while a capture ' +
854851
'callback was already active',

lib/tty.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ const net = require('net');
2626
const { internalBinding } = require('internal/bootstrap/loaders');
2727
const { TTY, isTTY } = internalBinding('tty_wrap');
2828
const errors = require('internal/errors');
29-
const {
30-
ERR_INVALID_FD,
31-
ERR_TTY_INIT_FAILED,
32-
ERR_TTY_WRITABLE_NOT_READABLE
33-
} = errors.codes;
29+
const { ERR_INVALID_FD, ERR_TTY_INIT_FAILED } = errors.codes;
3430
const { getColorDepth } = require('internal/tty');
3531

3632
// Lazy loaded for startup performance.
@@ -132,13 +128,6 @@ WriteStream.prototype._refreshSize = function() {
132128
}
133129
};
134130

135-
// A WriteStream is not readable from, so _read become a no-op.
136-
// this method could still be called because net.Socket()
137-
// is a duplex
138-
WriteStream.prototype._read = function() {
139-
this.destroy(new ERR_TTY_WRITABLE_NOT_READABLE());
140-
};
141-
142131
// Backwards-compat
143132
WriteStream.prototype.cursorTo = function(x, y) {
144133
if (readline === undefined) readline = require('readline');

test/pseudo-tty/test-tty-write-stream-resume-crash.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

test/pseudo-tty/test-tty-write-stream-resume-crash.out

Whitespace-only changes.

0 commit comments

Comments
 (0)