diff options
| author | Keith Ballinger <[email protected]> | 2025-06-24 17:39:01 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-25 00:39:01 +0000 |
| commit | b6ccf12551bf43992b89c8b2c78d1352e89787eb (patch) | |
| tree | 331067ace971323c57a8dfd89c2a96de02109ce4 | |
| parent | fbd8725c07d6ef3dacadcef6495ac75f2e24a62b (diff) | |
[June 25] handle early output pipe closer (#1402)
| -rw-r--r-- | packages/cli/src/nonInteractiveCli.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/cli/src/nonInteractiveCli.ts b/packages/cli/src/nonInteractiveCli.ts index 28db73f1..0855fc6d 100644 --- a/packages/cli/src/nonInteractiveCli.ts +++ b/packages/cli/src/nonInteractiveCli.ts @@ -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(); |
