diff options
| author | N. Taylor Mullen <[email protected]> | 2025-07-12 15:42:47 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-12 15:42:47 -0700 |
| commit | 4442e893c367a901a4c801816e0ade5b78c291c9 (patch) | |
| tree | a5962bb7e5995e33306bd33635f25f889f5c4b52 /packages/cli/src/utils/cleanup.ts | |
| parent | 890982a811e22de9525148e6c28f39bfbf10a49a (diff) | |
fix(auth): Remove sharp edges from headless auth (#3985)
Diffstat (limited to 'packages/cli/src/utils/cleanup.ts')
| -rw-r--r-- | packages/cli/src/utils/cleanup.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/packages/cli/src/utils/cleanup.ts b/packages/cli/src/utils/cleanup.ts index 4011ae30..628b881c 100644 --- a/packages/cli/src/utils/cleanup.ts +++ b/packages/cli/src/utils/cleanup.ts @@ -8,6 +8,23 @@ import { promises as fs } from 'fs'; import { join } from 'path'; import { getProjectTempDir } from '@google/gemini-cli-core'; +const cleanupFunctions: Array<() => void> = []; + +export function registerCleanup(fn: () => void) { + cleanupFunctions.push(fn); +} + +export function runExitCleanup() { + for (const fn of cleanupFunctions) { + try { + fn(); + } catch (_) { + // Ignore errors during cleanup. + } + } + cleanupFunctions.length = 0; // Clear the array +} + export async function cleanupCheckpoints() { const tempDir = getProjectTempDir(process.cwd()); const checkpointsDir = join(tempDir, 'checkpoints'); |
