Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(editor): play-realm staging rm absorbs concurrent-instance races

esengine884a4c8c8d4c
diff --git a/desktop/electron/buildPlayRealm.ts b/desktop/electron/buildPlayRealm.ts
index d1b81b2e4..0bc05b304 100644
--- a/desktop/electron/buildPlayRealm.ts
+++ b/desktop/electron/buildPlayRealm.ts
@@ -101,7 +101,9 @@ async function syncDir(src: string, dst: string, stampFile: string): Promise<voi
if (!existsSync(src)) return;
const sig = await dirSignature(src);
if (existsSync(dst) && existsSync(stampFile) && (await readFile(stampFile, 'utf8')) === sig) return;
- await rm(dst, { recursive: true, force: true });
+ // Retries absorb the transient ENOTEMPTY when another editor instance (or a
+ // crashed earlier copy) still has fingers in this disposable staging dir.
+ await rm(dst, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
await cp(src, dst, { recursive: true });
await writeFile(stampFile, sig);
}