[June 25] handle early output pipe closer (#1402)

This commit is contained in:
Keith Ballinger 2025-06-24 17:39:01 -07:00 committed by GitHub
parent fbd8725c07
commit b6ccf12551
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 0 deletions

View File

@ -47,6 +47,14 @@ export async function runNonInteractive(
config: Config,
input: string,
): Promise<void> {
// Handle EPIPE errors when the output is piped to a command that closes early.
process.stdout.on('error', (err: NodeJS.ErrnoException) => {
if (err.code === 'EPIPE') {
// Exit gracefully if the pipe is closed.
process.exit(0);
}
});
const geminiClient = config.getGeminiClient();
const toolRegistry: ToolRegistry = await config.getToolRegistry();