From 41c4b6b1f71628adcef30fdc5441cd93be1e8341 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Fri, 1 May 2026 14:21:08 +0300 Subject: [PATCH] =?UTF-8?q?fix(skills/tests):=20cleanupWorkspace=20=D1=82?= =?UTF-8?q?=D0=B5=D1=80=D0=BF=D0=B8=D0=BC=D0=BE=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=B6=D0=B8=D0=B2=D0=B0=D0=B5=D1=82=20EBUSY=20=D0=BE=D1=82=201?= =?UTF-8?q?cv8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit После платформенных тестов (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) --- tests/skills/runner.mjs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/skills/runner.mjs b/tests/skills/runner.mjs index cafe95df..f1728b5a 100644 --- a/tests/skills/runner.mjs +++ b/tests/skills/runner.mjs @@ -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}`); } }