Skip to content

Commit f58fe79

Browse files
authored
fix: prevent crashes if an inactive stream receives an error. (#2283)
1 parent a2950e0 commit f58fe79

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

dev/src/watch.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,12 @@ abstract class Watch<
495495
'Closing inactive stream'
496496
);
497497
backendStream.emit('end');
498+
backendStream.on('error', () => {
499+
// Note that emitting 'end' above does not prevent the Duplex
500+
// from receiving potential errors from the backend. Since the
501+
// stream is no longer active (`isActive` is false), we
502+
// swallow / ignore any errors it may receive.
503+
});
498504
return;
499505
}
500506
logger('Watch.initStream', this.requestTag, 'Opened new stream');

0 commit comments

Comments
 (0)