mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-06-10 16:14:54 +03:00
fix(skills/tests): cleanupWorkspace терпимо переживает EBUSY от 1cv8
После платформенных тестов (db-create/db-load-xml/db-update) Windows держит файловые хэндлы 1cv8 ещё несколько сотен миллисекунд. rmSync без ретраев падал EBUSY на Roles/.../Rights.xml, и uncaught-ошибка в finally рушила весь node-процесс — теряли результат теста. Теперь rmSync с maxRetries: 10, retryDelay: 200 (≈2с буфер) и try/catch вокруг — в худшем случае warning + лишняя tmp-папка вместо краша. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -196,8 +196,14 @@ function createWorkspace(fixturePath, readOnly) {
|
||||
}
|
||||
|
||||
function cleanupWorkspace(ws) {
|
||||
if (!ws.readOnly) {
|
||||
rmSync(ws.path, { recursive: true, force: true });
|
||||
if (ws.readOnly) return;
|
||||
// On Windows, file handles from db-update (1cv8) may linger briefly after the
|
||||
// process exits — rmSync then throws EBUSY. Retry a few times, then swallow:
|
||||
// a leaked tmp dir is preferable to crashing the entire runner.
|
||||
try {
|
||||
rmSync(ws.path, { recursive: true, force: true, maxRetries: 10, retryDelay: 200 });
|
||||
} catch (e) {
|
||||
console.warn(`Warning: failed to clean workspace ${ws.path}: ${e.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user