mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-18 01:51:20 -07:00
feat(core): improve shell execution service reliability (#10607)
This commit is contained in:
@@ -109,7 +109,6 @@ export const useShellCommandProcessor = (
|
||||
const executeCommand = async (
|
||||
resolve: (value: void | PromiseLike<void>) => void,
|
||||
) => {
|
||||
let lastUpdateTime = Date.now();
|
||||
let cumulativeStdout: string | AnsiOutput = '';
|
||||
let isBinaryStream = false;
|
||||
let binaryBytesReceived = 0;
|
||||
@@ -168,6 +167,7 @@ export const useShellCommandProcessor = (
|
||||
typeof cumulativeStdout === 'string'
|
||||
) {
|
||||
cumulativeStdout += event.chunk;
|
||||
shouldUpdate = true;
|
||||
}
|
||||
break;
|
||||
case 'binary_detected':
|
||||
@@ -178,6 +178,7 @@ export const useShellCommandProcessor = (
|
||||
case 'binary_progress':
|
||||
isBinaryStream = true;
|
||||
binaryBytesReceived = event.bytesReceived;
|
||||
shouldUpdate = true;
|
||||
break;
|
||||
default: {
|
||||
throw new Error('An unhandled ShellOutputEvent was found.');
|
||||
@@ -200,10 +201,7 @@ export const useShellCommandProcessor = (
|
||||
}
|
||||
|
||||
// Throttle pending UI updates, but allow forced updates.
|
||||
if (
|
||||
shouldUpdate ||
|
||||
Date.now() - lastUpdateTime > OUTPUT_UPDATE_INTERVAL_MS
|
||||
) {
|
||||
if (shouldUpdate) {
|
||||
setPendingHistoryItem((prevItem) => {
|
||||
if (prevItem?.type === 'tool_group') {
|
||||
return {
|
||||
@@ -217,7 +215,6 @@ export const useShellCommandProcessor = (
|
||||
}
|
||||
return prevItem;
|
||||
});
|
||||
lastUpdateTime = Date.now();
|
||||
}
|
||||
},
|
||||
abortSignal,
|
||||
|
||||
Reference in New Issue
Block a user