From 36d22849db52c238a971bfe0a975c5e4f78f4d79 Mon Sep 17 00:00:00 2001 From: Erik Demaine Date: Mon, 7 Sep 2026 14:23:14 -0400 Subject: [PATCH 1/2] fix(desktop): extract Electron with PowerShell on Windows --- apps/desktop/scripts/ensure-electron-runtime.mjs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/desktop/scripts/ensure-electron-runtime.mjs b/apps/desktop/scripts/ensure-electron-runtime.mjs index b8b8254c9b3c..3a782437281e 100644 --- a/apps/desktop/scripts/ensure-electron-runtime.mjs +++ b/apps/desktop/scripts/ensure-electron-runtime.mjs @@ -129,6 +129,15 @@ function installElectronRuntime(electronDir, version) { ]); if (hostPlatform === "darwin") { runChecked("ditto", ["-x", "-k", zipPath, NodePath.join(electronDir, "dist")]); + } else if (hostPlatform === "win32") { + // Windows includes PowerShell, but python3 may only be a Microsoft Store alias. + const quote = (value) => `'${value.replaceAll("'", "''")}'`; + runChecked("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath ${quote(zipPath)} -DestinationPath ${quote(NodePath.join(electronDir, "dist"))} -Force -ErrorAction Stop`, + ]); } else { runChecked("python3", [ "-c", From 0bc10f1bda375a5a663c23f8e51c1e3d6f9c42c3 Mon Sep 17 00:00:00 2001 From: Erik Demaine Date: Mon, 7 Sep 2026 14:49:07 -0400 Subject: [PATCH 2/2] fix(desktop): pass paths via environment instead of quoted arguments --- .../scripts/ensure-electron-runtime.mjs | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/apps/desktop/scripts/ensure-electron-runtime.mjs b/apps/desktop/scripts/ensure-electron-runtime.mjs index 3a782437281e..cd9a89b07dee 100644 --- a/apps/desktop/scripts/ensure-electron-runtime.mjs +++ b/apps/desktop/scripts/ensure-electron-runtime.mjs @@ -101,10 +101,11 @@ function invalidRuntimePaths(electronDir, platformPath) { ].filter((runtimePath) => NodeFS.existsSync(runtimePath) && !isMachO(runtimePath)); } -function runChecked(command, args) { +function runChecked(command, args, env) { const result = NodeChildProcess.spawnSync(command, args, { encoding: "utf8", stdio: "inherit", + env, }); if (result.status === 0) { @@ -131,13 +132,21 @@ function installElectronRuntime(electronDir, version) { runChecked("ditto", ["-x", "-k", zipPath, NodePath.join(electronDir, "dist")]); } else if (hostPlatform === "win32") { // Windows includes PowerShell, but python3 may only be a Microsoft Store alias. - const quote = (value) => `'${value.replaceAll("'", "''")}'`; - runChecked("powershell.exe", [ - "-NoProfile", - "-NonInteractive", - "-Command", - `Expand-Archive -LiteralPath ${quote(zipPath)} -DestinationPath ${quote(NodePath.join(electronDir, "dist"))} -Force -ErrorAction Stop`, - ]); + // Pass paths as data: PowerShell also treats curly apostrophes as string delimiters. + runChecked( + "powershell.exe", + [ + "-NoProfile", + "-NonInteractive", + "-Command", + "Expand-Archive -LiteralPath $env:T3_ELECTRON_ARCHIVE -DestinationPath $env:T3_ELECTRON_DESTINATION -Force -ErrorAction Stop", + ], + { + ...process.env, + T3_ELECTRON_ARCHIVE: zipPath, + T3_ELECTRON_DESTINATION: NodePath.join(electronDir, "dist"), + }, + ); } else { runChecked("python3", [ "-c",