Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Nov 19, 2021
1 parent 6fbe14d commit 854a752
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/internal/streams/destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,12 @@ function emitErrorCloseLegacy(stream, err) {
}

// Normalize destroy for legacy.
function destroyer(stream, err) {
function destroyer(stream, err, options) {
if (!stream || isDestroyed(stream)) {
return;
}

if (!err && !isFinished(stream)) {
if (!err && !isFinished(stream) && options?.autoAbort !== false) {
err = new AbortError();
}

Expand Down
4 changes: 3 additions & 1 deletion lib/internal/streams/readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,9 @@ async function* createAsyncIterator(stream, options) {
(error || options?.destroyOnReturn !== false) &&
(error === undefined || stream._readableState.autoDestroy)
) {
destroyImpl.destroyer(stream, null);
destroyImpl.destroyer(stream, null, {
autoAbort: false
});
}
}
}
Expand Down

0 comments on commit 854a752

Please sign in to comment.