fix(auth): Remove sharp edges from headless auth (#3985)

This commit is contained in:
N. Taylor Mullen
2025-07-12 15:42:47 -07:00
committed by GitHub
parent 890982a811
commit 4442e893c3
8 changed files with 118 additions and 85 deletions

View File

@@ -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');