fix(build): runtime 清理失败时回退 shell rm -rf

避免 macOS 上 pnpm node_modules 树导致 ENOTEMPTY 阻断发布构建。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-06 17:06:06 +08:00
parent 0ae7a6a677
commit 3befb0e257
+7 -1
View File
@@ -65,7 +65,13 @@ async function exists(targetPath) {
}
async function remove(targetPath) {
await fs.rm(targetPath, { recursive: true, force: true });
if (!(await exists(targetPath))) return;
try {
await fs.rm(targetPath, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
} catch (error) {
if (error?.code !== 'ENOTEMPTY' && error?.code !== 'EBUSY') throw error;
await run('rm', ['-rf', targetPath]);
}
}
async function copyDir(source, target) {