From a01de4ad0c4c32c52413f71d2363558a5de7b4ec Mon Sep 17 00:00:00 2001 From: Igor Warzocha Date: Wed, 19 Aug 2026 20:44:06 +0100 Subject: [PATCH] Fix Windows Electron archive extraction --- scripts/install-electron.cjs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/install-electron.cjs b/scripts/install-electron.cjs index caf1781b4..77d228bb3 100644 --- a/scripts/install-electron.cjs +++ b/scripts/install-electron.cjs @@ -79,17 +79,24 @@ async function extractZip(zipPath, distPath) { // the first entry under Node 26. The Electron archives are ordinary zip files, // so use OS-provided archive tools and verify the executable afterward. if (process.platform === 'win32') { + const archivePathEnv = 'HOWCODE_ELECTRON_ARCHIVE_PATH' + const destinationPathEnv = 'HOWCODE_ELECTRON_DESTINATION_PATH' childProcess.execFileSync( 'powershell.exe', [ '-NoProfile', '-NonInteractive', '-Command', - 'Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force', - zipPath, - distPath, + `$ErrorActionPreference = 'Stop'; Expand-Archive -LiteralPath $env:${archivePathEnv} -DestinationPath $env:${destinationPathEnv} -Force`, ], - { stdio: 'inherit' }, + { + stdio: 'inherit', + env: { + ...process.env, + [archivePathEnv]: zipPath, + [destinationPathEnv]: distPath, + }, + }, ) return }