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:
Nick Shirokov
2026-05-01 14:21:08 +03:00
parent ffb0ee740d
commit 41c4b6b1f7
+8 -2
View File
@@ -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}`);
}
}