Skip to content

Commit 7d127d2

Browse files
ronagtargos
authored andcommitted
stream: fix non readable Duplex readableAborted
PR-URL: #40801 Fixes: #40800 Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent e451ec9 commit 7d127d2

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

lib/internal/streams/readable.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1187,8 +1187,11 @@ ObjectDefineProperties(Readable.prototype, {
11871187
readableAborted: {
11881188
enumerable: false,
11891189
get: function() {
1190-
return !!(this._readableState.destroyed || this._readableState.errored) &&
1191-
!this._readableState.endEmitted;
1190+
return !!(
1191+
this._readableState.readable !== false &&
1192+
(this._readableState.destroyed || this._readableState.errored) &&
1193+
!this._readableState.endEmitted
1194+
);
11921195
}
11931196
},
11941197

test/parallel/test-stream-readable-aborted.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const common = require('../common');
44
const assert = require('assert');
5-
const { Readable } = require('stream');
5+
const { Readable, Duplex } = require('stream');
66

77
{
88
const readable = new Readable({
@@ -55,3 +55,12 @@ const { Readable } = require('stream');
5555
}));
5656
readable.resume();
5757
}
58+
59+
{
60+
const duplex = new Duplex({
61+
readable: false,
62+
write() {}
63+
});
64+
duplex.destroy();
65+
assert.strictEqual(duplex.readableAborted, false);
66+
}

0 commit comments

Comments
 (0)