Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stream: always delay construct callback by a nextTick #46818

Merged
merged 3 commits into from
Feb 26, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup
Signed-off-by: Matteo Collina <hello@matteocollina.com>
mcollina committed Feb 24, 2023

Verified

This commit was signed with the committer’s verified signature.
mcollina Matteo Collina
commit e65f74351cb638c950bd7ee5c2f26516167d997d
10 changes: 4 additions & 6 deletions lib/internal/streams/destroy.js
Original file line number Diff line number Diff line change
@@ -271,14 +271,12 @@ function constructNT(stream) {
}
}

function jump(err) {
process.nextTick(onConstruct, err);
}

try {
stream._construct(jump);
stream._construct((err) => {
process.nextTick(onConstruct, err);
})
} catch (err) {
jump(err);
process.nextTick(onConstruct, err);
}
}