mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-06 08:24:46 +00:00
Desktop logging reaches inherited stdout and stderr before the CLI guards run. A launcher that closes its output reader raised an uncaught EPIPE dialog. Handle closed console pipes at desktop startup while preserving console logging and surfacing other stream errors. Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
12 lines
357 B
TypeScript
12 lines
357 B
TypeScript
function ignoreClosedConsole(error: NodeJS.ErrnoException): void {
|
|
if (error.code !== "EPIPE") {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
/** Keep desktop logging independent of the program that launched its console. */
|
|
export function protectConsoleStreams(): void {
|
|
process.stdout.on("error", ignoreClosedConsole);
|
|
process.stderr.on("error", ignoreClosedConsole);
|
|
}
|