mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-24 03:54:43 -07:00
Checkpoint of shell optimization
fix(cli): Write shell command output to a file and limit memory buffered in UI Fixes. Checkpoint. fix(core, cli): await outputStream.end() to prevent race conditions This commit fixes a critical race condition where was called synchronously without being awaited. This led to potential file truncation or EBUSY errors on Windows when attempting to manipulate the file immediately after the call. Additionally, this change removes fixed wait times (`setTimeout`) that were previously used in test files as a band-aid. fix(core): stream processed xterm output to file to remove spurious escape codes test(core): update shell regression tests to use file_data events
This commit is contained in:
@@ -489,6 +489,7 @@ describe('ShellExecutionService', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
headlessTerminal: mockHeadlessTerminal as any,
|
||||
command: 'some-command',
|
||||
lastCommittedLine: -1,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -989,6 +990,8 @@ describe('ShellExecutionService', () => {
|
||||
pty.onExit.mock.calls[0][0]({ exitCode: 0, signal: null });
|
||||
});
|
||||
|
||||
// We don't check result here because result is not available in the test body as written
|
||||
// The test body doesn't capture the return value of simulateExecution correctly for this assertion.
|
||||
expect(onOutputEventMock).toHaveBeenCalledTimes(4);
|
||||
expect(onOutputEventMock.mock.calls[0][0]).toEqual({
|
||||
type: 'binary_detected',
|
||||
@@ -1579,6 +1582,8 @@ describe('ShellExecutionService child_process fallback', () => {
|
||||
cp.emit('exit', 0, null);
|
||||
});
|
||||
|
||||
// We don't check result here because result is not available in the test body as written
|
||||
// The test body doesn't capture the return value of simulateExecution correctly for this assertion.
|
||||
expect(onOutputEventMock).toHaveBeenCalledTimes(4);
|
||||
expect(onOutputEventMock.mock.calls[0][0]).toEqual({
|
||||
type: 'binary_detected',
|
||||
|
||||
Reference in New Issue
Block a user