[June 25] handle early output pipe closer (#1402)
This commit is contained in:
parent
fbd8725c07
commit
b6ccf12551
|
@ -47,6 +47,14 @@ export async function runNonInteractive(
|
||||||
config: Config,
|
config: Config,
|
||||||
input: string,
|
input: string,
|
||||||
): Promise<void> {
|
): 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 geminiClient = config.getGeminiClient();
|
||||||
const toolRegistry: ToolRegistry = await config.getToolRegistry();
|
const toolRegistry: ToolRegistry = await config.getToolRegistry();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue