mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-20 18:14:29 -07:00
Fix shell output display (#24490)
This commit is contained in:
@@ -19,6 +19,7 @@ export type ExecutionMethod =
|
||||
export interface ExecutionResult {
|
||||
rawOutput?: Buffer;
|
||||
output: string;
|
||||
ansiOutput?: AnsiOutput;
|
||||
exitCode: number | null;
|
||||
signal: number | null;
|
||||
error: Error | null;
|
||||
@@ -452,10 +453,13 @@ export class ExecutionLifecycleService {
|
||||
} = options ?? {};
|
||||
|
||||
const output = execution.getBackgroundOutput?.() ?? execution.output;
|
||||
const snapshot = execution.getSubscriptionSnapshot?.();
|
||||
const ansiOutput = Array.isArray(snapshot) ? snapshot : undefined;
|
||||
|
||||
this.settleExecution(executionId, {
|
||||
rawOutput: Buffer.from(output, 'utf8'),
|
||||
output,
|
||||
ansiOutput,
|
||||
exitCode,
|
||||
signal,
|
||||
error,
|
||||
|
||||
@@ -1123,9 +1123,21 @@ export class ShellExecutionService {
|
||||
ShellExecutionService.activePtys.delete(ptyPid);
|
||||
});
|
||||
|
||||
const endLine = headlessTerminal.buffer.active.length;
|
||||
const startLine = Math.max(
|
||||
0,
|
||||
endLine - (shellExecutionConfig.maxSerializedLines ?? 2000),
|
||||
);
|
||||
const ansiOutputSnapshot = serializeTerminalToObject(
|
||||
headlessTerminal,
|
||||
startLine,
|
||||
endLine,
|
||||
);
|
||||
|
||||
ExecutionLifecycleService.completeWithResult(ptyPid, {
|
||||
rawOutput: Buffer.from(''),
|
||||
output: getFullBufferText(headlessTerminal),
|
||||
ansiOutput: ansiOutputSnapshot,
|
||||
exitCode,
|
||||
signal: signal ?? null,
|
||||
error,
|
||||
|
||||
Reference in New Issue
Block a user