Skip to content

Commit 61c18c4

Browse files
committed
stream: fix non readable Duplex readableAborted
1 parent f217025 commit 61c18c4

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

lib/internal/streams/readable.js

Lines changed: 5 additions & 2 deletions
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 &&
1192+
!!(this._readableState.destroyed || this._readableState.errored) &&
1193+
!this._readableState.endEmitted
1194+
);
11921195
}
11931196
},
11941197

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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(readable.readableAborted, false);
66+
}

0 commit comments

Comments
 (0)