Closed
Description
Related to #23133.
Even if we change so that open
is emitted before destroy
. pipeline
will not wait for completed destruction for all streams. Which can cause subtle bugs with things like:
const rec = db.getRecord(blockId)
pipeline(
req,
fs.createWriteStream(blockPath, { flags: 'wx' })
.on('open', () => {
// Oops, this can be called after rec.destroy() :/. I didn't expect that.
rec.set({
path: blockPath
})
}),
err => {
rec.destroy()
callback(err)
}
)