Skip to content

Commit

Permalink
stream: fix non readable Duplex readableAborted
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Nov 13, 2021
1 parent f217025 commit 4c06554
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/internal/streams/readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1187,8 +1187,11 @@ ObjectDefineProperties(Readable.prototype, {
readableAborted: {
enumerable: false,
get: function() {
return !!(this._readableState.destroyed || this._readableState.errored) &&
!this._readableState.endEmitted;
return !!(
this._readableState.readable &&
(this._readableState.destroyed || this._readableState.errored) &&
!this._readableState.endEmitted
);
}
},

Expand Down
9 changes: 9 additions & 0 deletions test/parallel/test-stream-readable-aborted.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,12 @@ const { Readable } = require('stream');
}));
readable.resume();
}

{
const duplex = new Duplex({
readable: false,
write () {}
});
duplex.destroy();
assert.strictEqual(readable.readableAborted, false);
}

0 comments on commit 4c06554

Please sign in to comment.