Fix error handler in LogStreamManager to avoid race conditions

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-11-16 12:54:58 +00:00
parent 995b035d40
commit 07e8b4a9ba

View File

@ -32,7 +32,8 @@ export class LogStreamManager extends EventEmitter {
// Handle stream errors // Handle stream errors
stream.on('error', (error) => { stream.on('error', (error) => {
this.emit('error', { filePath, error }); this.emit('error', { filePath, error });
this.closeStream(filePath); // Remove the stream from the map on error
this.streams.delete(filePath);
reject(error); reject(error);
}); });
} }