Skip to content

Commit

Permalink
fix: prevent crashes if an inactive stream receives an error. (#2283)
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsannas authored Jan 21, 2025
1 parent a2950e0 commit f58fe79
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dev/src/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,12 @@ abstract class Watch<
'Closing inactive stream'
);
backendStream.emit('end');
backendStream.on('error', () => {
// Note that emitting 'end' above does not prevent the Duplex
// from receiving potential errors from the backend. Since the
// stream is no longer active (`isActive` is false), we
// swallow / ignore any errors it may receive.
});
return;
}
logger('Watch.initStream', this.requestTag, 'Opened new stream');
Expand Down

0 comments on commit f58fe79

Please sign in to comment.