Update error codes when process exiting the gemini cli (#13728)

This commit is contained in:
Megha Bansal
2025-11-26 08:13:21 +05:30
committed by GitHub
parent d2a6cff4df
commit d97bbd5324
12 changed files with 307 additions and 192 deletions

View File

@@ -9,6 +9,7 @@ import { waitFor } from '../../test-utils/async.js';
import { act } from 'react';
import { vi } from 'vitest';
import { FolderTrustDialog } from './FolderTrustDialog.js';
import { ExitCodes } from '@google/gemini-cli-core';
import * as processUtils from '../../utils/processUtils.js';
vi.mock('../../utils/processUtils.js', () => ({
@@ -61,7 +62,9 @@ describe('FolderTrustDialog', () => {
);
});
await waitFor(() => {
expect(mockedExit).toHaveBeenCalledWith(1);
expect(mockedExit).toHaveBeenCalledWith(
ExitCodes.FATAL_CANCELLATION_ERROR,
);
});
expect(onSelect).not.toHaveBeenCalled();
});

View File

@@ -14,6 +14,8 @@ import { useKeypress } from '../hooks/useKeypress.js';
import * as process from 'node:process';
import * as path from 'node:path';
import { relaunchApp } from '../../utils/processUtils.js';
import { runExitCleanup } from '../../utils/cleanup.js';
import { ExitCodes } from '@google/gemini-cli-core';
export enum FolderTrustChoice {
TRUST_FOLDER = 'trust_folder',
@@ -46,8 +48,9 @@ export const FolderTrustDialog: React.FC<FolderTrustDialogProps> = ({
(key) => {
if (key.name === 'escape') {
setExiting(true);
setTimeout(() => {
process.exit(1);
setTimeout(async () => {
await runExitCleanup();
process.exit(ExitCodes.FATAL_CANCELLATION_ERROR);
}, 100);
}
},