Skip to content

Commit 218ada9

Browse files
ronagdanielleadams
authored andcommitted
stream: fix non readable Duplex readableAborted
PR-URL: #40801 Fixes: #40800 Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent c6ca23c commit 218ada9

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

lib/internal/streams/readable.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,8 +1190,11 @@ ObjectDefineProperties(Readable.prototype, {
11901190
readableAborted: {
11911191
enumerable: false,
11921192
get: function() {
1193-
return !!(this._readableState.destroyed || this._readableState.errored) &&
1194-
!this._readableState.endEmitted;
1193+
return !!(
1194+
this._readableState.readable !== false &&
1195+
(this._readableState.destroyed || this._readableState.errored) &&
1196+
!this._readableState.endEmitted
1197+
);
11951198
}
11961199
},
11971200

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

Lines changed: 10 additions & 1 deletion
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)