mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-16 08:10:46 -07:00
fix(core): ensure binary shell output files are still written to disk for 20MB files, and wait for stream close
This commit is contained in:
@@ -532,10 +532,8 @@ export class ShellToolInvocation extends BaseToolInvocation<
|
||||
// We rely on 'file_data' for the clean output stream.
|
||||
break;
|
||||
case 'file_data':
|
||||
if (!isBinaryStream) {
|
||||
totalBytesWritten += Buffer.byteLength(event.chunk);
|
||||
outputStream.write(event.chunk);
|
||||
}
|
||||
totalBytesWritten += Buffer.byteLength(event.chunk);
|
||||
outputStream.write(event.chunk);
|
||||
break;
|
||||
case 'data':
|
||||
if (isBinaryStream) break;
|
||||
@@ -676,6 +674,11 @@ export class ShellToolInvocation extends BaseToolInvocation<
|
||||
outputStream.end(resolve);
|
||||
});
|
||||
|
||||
// Ensure the stream is fully closed before we proceed
|
||||
if (!outputStream.closed) {
|
||||
await new Promise<void>((resolve) => outputStream.on('close', resolve));
|
||||
}
|
||||
|
||||
const backgroundPIDs: number[] = [];
|
||||
if (os.platform() !== 'win32') {
|
||||
let tempFileExists = false;
|
||||
|
||||
Reference in New Issue
Block a user