mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 14:10:37 -07:00
Resolves the confusing error message `ripgrep exited with code null that occurs when a search operation is cancelled or aborted (#14267)
Co-authored-by: Gal Zahavi <38544478+galz10@users.noreply.github.com>
This commit is contained in:
@@ -1009,10 +1009,10 @@ describe('RipGrepTool', () => {
|
||||
|
||||
const result = await invocation.execute(controller.signal);
|
||||
expect(result.llmContent).toContain(
|
||||
'Error during grep search operation: ripgrep exited with code null',
|
||||
'Error during grep search operation: ripgrep was terminated by signal:',
|
||||
);
|
||||
expect(result.returnDisplay).toContain(
|
||||
'Error: ripgrep exited with code null',
|
||||
'Error: ripgrep was terminated by signal:',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -432,7 +432,7 @@ class GrepToolInvocation extends BaseToolInvocation<
|
||||
);
|
||||
});
|
||||
|
||||
child.on('close', (code) => {
|
||||
child.on('close', (code, signal) => {
|
||||
options.signal.removeEventListener('abort', cleanup);
|
||||
const stdoutData = Buffer.concat(stdoutChunks).toString('utf8');
|
||||
const stderrData = Buffer.concat(stderrChunks).toString('utf8');
|
||||
@@ -442,9 +442,13 @@ class GrepToolInvocation extends BaseToolInvocation<
|
||||
} else if (code === 1) {
|
||||
resolve(''); // No matches found
|
||||
} else {
|
||||
reject(
|
||||
new Error(`ripgrep exited with code ${code}: ${stderrData}`),
|
||||
);
|
||||
if (signal) {
|
||||
reject(new Error(`ripgrep was terminated by signal: ${signal}`));
|
||||
} else {
|
||||
reject(
|
||||
new Error(`ripgrep exited with code ${code}: ${stderrData}`),
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user