mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-09 05:16:02 +00:00
Find more ways to destroy streams
This commit is contained in:
parent
51a6dda660
commit
60ede0bf46
1 changed files with 6 additions and 2 deletions
|
@ -106,11 +106,12 @@ function getReadyPipeline(...streams) {
|
|||
|
||||
lastStream.removeListener('readable', handler)
|
||||
if (err) {
|
||||
return reject(
|
||||
reject(
|
||||
wrapError(err, 'error before stream became ready', {}, ReadError)
|
||||
)
|
||||
} else {
|
||||
resolve(lastStream)
|
||||
}
|
||||
resolve(lastStream)
|
||||
}
|
||||
if (err) {
|
||||
for (const stream of streams) {
|
||||
|
@ -121,6 +122,9 @@ function getReadyPipeline(...streams) {
|
|||
}
|
||||
}
|
||||
|
||||
for (let index = 0; index < streams.length - 1; index++) {
|
||||
streams[index + 1].on('close', () => streams[index].destroy())
|
||||
}
|
||||
pipeline(...streams).catch(handler)
|
||||
lastStream.on('readable', handler)
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue