Skip to content

Commit

Permalink
fix: prevent crashes if an inactive stream receives an error.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsannas committed Jan 13, 2025
1 parent 1e714a8 commit ecbf9fc
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 ecbf9fc

Please sign in to comment.