mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 21:03:05 -07:00
fix(core): ensure childProcessFallback also streams file_data unconditionally without truncation
This commit is contained in:
@@ -375,7 +375,6 @@ export class ShellExecutionService {
|
|||||||
const outputFilePath = path.join(os.tmpdir(), outputFileName);
|
const outputFilePath = path.join(os.tmpdir(), outputFileName);
|
||||||
const outputStream = fs.createWriteStream(outputFilePath);
|
const outputStream = fs.createWriteStream(outputFilePath);
|
||||||
|
|
||||||
let isBinaryStream = false;
|
|
||||||
let totalBytesWritten = 0;
|
let totalBytesWritten = 0;
|
||||||
|
|
||||||
const interceptedOnOutputEvent = (event: ShellOutputEvent) => {
|
const interceptedOnOutputEvent = (event: ShellOutputEvent) => {
|
||||||
@@ -383,14 +382,11 @@ export class ShellExecutionService {
|
|||||||
case 'raw_data':
|
case 'raw_data':
|
||||||
break;
|
break;
|
||||||
case 'file_data':
|
case 'file_data':
|
||||||
if (!isBinaryStream) {
|
outputStream.write(event.chunk);
|
||||||
outputStream.write(event.chunk);
|
totalBytesWritten += Buffer.byteLength(event.chunk);
|
||||||
totalBytesWritten += Buffer.byteLength(event.chunk);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'binary_detected':
|
case 'binary_detected':
|
||||||
case 'binary_progress':
|
case 'binary_progress':
|
||||||
isBinaryStream = true;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -788,6 +784,24 @@ export class ShellExecutionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (decodedChunk) {
|
if (decodedChunk) {
|
||||||
|
const rawEvent: ShellOutputEvent = {
|
||||||
|
type: 'raw_data',
|
||||||
|
chunk: decodedChunk,
|
||||||
|
};
|
||||||
|
onOutputEvent(rawEvent);
|
||||||
|
if (child.pid) {
|
||||||
|
ExecutionLifecycleService.emitEvent(child.pid, rawEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
const fileEvent: ShellOutputEvent = {
|
||||||
|
type: 'file_data',
|
||||||
|
chunk: stripAnsi(decodedChunk),
|
||||||
|
};
|
||||||
|
onOutputEvent(fileEvent);
|
||||||
|
if (child.pid) {
|
||||||
|
ExecutionLifecycleService.emitEvent(child.pid, fileEvent);
|
||||||
|
}
|
||||||
|
|
||||||
const event: ShellOutputEvent = {
|
const event: ShellOutputEvent = {
|
||||||
type: 'data',
|
type: 'data',
|
||||||
chunk: decodedChunk,
|
chunk: decodedChunk,
|
||||||
|
|||||||
Reference in New Issue
Block a user