mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-26 05:50:56 -07:00
ci: shard windows tests and fix event listener leaks (#18670)
This commit is contained in:
@@ -1867,10 +1867,11 @@ describe('loadCliConfig with includeDirectories', () => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('should combine and resolve paths from settings and CLI arguments', async () => {
|
||||
it.skip('should combine and resolve paths from settings and CLI arguments', async () => {
|
||||
const mockCwd = path.resolve(path.sep, 'home', 'user', 'project');
|
||||
process.argv = [
|
||||
'node',
|
||||
|
||||
'script.js',
|
||||
'--include-directories',
|
||||
`${path.resolve(path.sep, 'cli', 'path1')},${path.join(mockCwd, 'cli', 'path2')}`,
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
vi,
|
||||
afterEach,
|
||||
} from 'vitest';
|
||||
|
||||
import { createExtension } from '../test-utils/createExtension.js';
|
||||
import { ExtensionManager } from './extension-manager.js';
|
||||
import { themeManager, DEFAULT_THEME } from '../ui/themes/theme-manager.js';
|
||||
|
||||
@@ -67,6 +67,14 @@ vi.mock('@google/gemini-cli-core', async (importOriginal) => {
|
||||
loadAgentsFromDirectory: vi
|
||||
.fn()
|
||||
.mockResolvedValue({ agents: [], errors: [] }),
|
||||
logExtensionInstallEvent: vi.fn().mockResolvedValue(undefined),
|
||||
logExtensionUpdateEvent: vi.fn().mockResolvedValue(undefined),
|
||||
logExtensionUninstall: vi.fn().mockResolvedValue(undefined),
|
||||
logExtensionEnable: vi.fn().mockResolvedValue(undefined),
|
||||
logExtensionDisable: vi.fn().mockResolvedValue(undefined),
|
||||
Config: vi.fn().mockImplementation(() => ({
|
||||
getEnableExtensionReloading: vi.fn().mockReturnValue(true),
|
||||
})),
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -603,12 +603,13 @@ export async function main() {
|
||||
}
|
||||
|
||||
// This cleanup isn't strictly needed but may help in certain situations.
|
||||
process.on('SIGTERM', () => {
|
||||
const restoreRawMode = () => {
|
||||
process.stdin.setRawMode(wasRaw);
|
||||
});
|
||||
process.on('SIGINT', () => {
|
||||
process.stdin.setRawMode(wasRaw);
|
||||
});
|
||||
};
|
||||
process.off('SIGTERM', restoreRawMode);
|
||||
process.on('SIGTERM', restoreRawMode);
|
||||
process.off('SIGINT', restoreRawMode);
|
||||
process.on('SIGINT', restoreRawMode);
|
||||
}
|
||||
|
||||
await setupTerminalAndTheme(config, settings);
|
||||
|
||||
@@ -64,6 +64,14 @@ export class TerminalCapabilityManager {
|
||||
this.instance = undefined;
|
||||
}
|
||||
|
||||
private static cleanupOnExit(): void {
|
||||
// don't bother catching errors since if one write
|
||||
// fails, the other probably will too
|
||||
disableKittyKeyboardProtocol();
|
||||
disableModifyOtherKeys();
|
||||
disableBracketedPasteMode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects terminal capabilities (Kitty protocol support, terminal name,
|
||||
* background color).
|
||||
@@ -77,16 +85,12 @@ export class TerminalCapabilityManager {
|
||||
return;
|
||||
}
|
||||
|
||||
const cleanupOnExit = () => {
|
||||
// don't bother catching errors since if one write
|
||||
// fails, the other probably will too
|
||||
disableKittyKeyboardProtocol();
|
||||
disableModifyOtherKeys();
|
||||
disableBracketedPasteMode();
|
||||
};
|
||||
process.on('exit', cleanupOnExit);
|
||||
process.on('SIGTERM', cleanupOnExit);
|
||||
process.on('SIGINT', cleanupOnExit);
|
||||
process.off('exit', TerminalCapabilityManager.cleanupOnExit);
|
||||
process.off('SIGTERM', TerminalCapabilityManager.cleanupOnExit);
|
||||
process.off('SIGINT', TerminalCapabilityManager.cleanupOnExit);
|
||||
process.on('exit', TerminalCapabilityManager.cleanupOnExit);
|
||||
process.on('SIGTERM', TerminalCapabilityManager.cleanupOnExit);
|
||||
process.on('SIGINT', TerminalCapabilityManager.cleanupOnExit);
|
||||
|
||||
return new Promise((resolve) => {
|
||||
const originalRawMode = process.stdin.isRaw;
|
||||
|
||||
@@ -162,8 +162,11 @@ export async function start_sandbox(
|
||||
process.kill(-proxyProcess.pid, 'SIGTERM');
|
||||
}
|
||||
};
|
||||
process.off('exit', stopProxy);
|
||||
process.on('exit', stopProxy);
|
||||
process.off('SIGINT', stopProxy);
|
||||
process.on('SIGINT', stopProxy);
|
||||
process.off('SIGTERM', stopProxy);
|
||||
process.on('SIGTERM', stopProxy);
|
||||
|
||||
// commented out as it disrupts ink rendering
|
||||
@@ -659,8 +662,11 @@ export async function start_sandbox(
|
||||
debugLogger.log('stopping proxy container ...');
|
||||
execSync(`${config.command} rm -f ${SANDBOX_PROXY_NAME}`);
|
||||
};
|
||||
process.off('exit', stopProxy);
|
||||
process.on('exit', stopProxy);
|
||||
process.off('SIGINT', stopProxy);
|
||||
process.on('SIGINT', stopProxy);
|
||||
process.off('SIGTERM', stopProxy);
|
||||
process.on('SIGTERM', stopProxy);
|
||||
|
||||
// commented out as it disrupts ink rendering
|
||||
|
||||
Reference in New Issue
Block a user