mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-30 21:52:50 -07:00
test(rig): improve cleanDir with exponential backoff and better logging for Windows
This commit is contained in:
@@ -370,11 +370,20 @@ export class TestRig {
|
||||
fs.rmSync(dir, { recursive: true, force: true });
|
||||
return;
|
||||
} catch (err) {
|
||||
if (i === 4) throw err;
|
||||
if (i === 4) {
|
||||
console.error(
|
||||
`Failed to clean directory ${dir} after 5 attempts:`,
|
||||
err,
|
||||
);
|
||||
throw err;
|
||||
}
|
||||
const delay = Math.pow(2, i) * 1000;
|
||||
const sleepCmd =
|
||||
process.platform === 'win32' ? 'timeout /t 1' : 'sleep 1';
|
||||
process.platform === 'win32'
|
||||
? `timeout /t ${Math.max(1, Math.floor(delay / 1000))} /nobreak`
|
||||
: `sleep ${delay / 1000}`;
|
||||
try {
|
||||
execSync(sleepCmd);
|
||||
execSync(sleepCmd, { stdio: 'ignore' });
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user