Fix EPIPE error when console stdout is disconnected

Wrap console output in try-catch to gracefully handle EPIPE errors
that occur when a parent process consuming output dies unexpectedly.

Fixes MAESTRO-5C
This commit is contained in:
Pedram Amini
2026-02-04 11:40:58 -06:00
parent af4a6c4c93
commit 3109189305

View File

@@ -167,6 +167,10 @@ class Logger extends EventEmitter {
}
// Also output to console for development
// Wrapped in try-catch to handle EPIPE errors when stdout/stderr is disconnected
// (e.g., when a parent process consuming output dies unexpectedly)
// Fixes MAESTRO-5C
try {
switch (entry.level) {
case 'error':
console.error(message, entry.data || '');
@@ -189,6 +193,10 @@ class Logger extends EventEmitter {
console.info(message, entry.data || '');
break;
}
} catch (err) {
// Silently ignore EPIPE errors - console is disconnected
// Other errors are also ignored to prevent infinite loops
}
}
debug(message: string, context?: string, data?: unknown): void {