fix: use PowerShell for Windows auto-update extraction

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
MiTHRAL 2026-04-21 13:20:33 -04:00
parent 25543cb7ba
commit fb9d583c71

View file

@ -62,10 +62,13 @@ async function downloadAndInstall(url: string, version: string) {
const installDir = dirname(process.execPath); const installDir = dirname(process.execPath);
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
exec( const cmd =
`unzip -o "${zipPath}" -d "${extractDir}" && SUBDIR=$(ls "${extractDir}" | head -1) && cp -rT "${extractDir}/$SUBDIR" "${installDir}"`, process.platform === "win32"
{ shell: "/bin/bash" }, ? `powershell -Command "Expand-Archive -Force -Path '${zipPath}' -DestinationPath '${extractDir}'; $sub = (Get-ChildItem '${extractDir}' | Select-Object -First 1).FullName; Copy-Item -Recurse -Force \\"$sub\\*\\" '${installDir}'"`
(err) => (err ? reject(err) : resolve()), : `unzip -o "${zipPath}" -d "${extractDir}" && SUBDIR=$(ls "${extractDir}" | head -1) && cp -rT "${extractDir}/$SUBDIR" "${installDir}"`;
exec(cmd, { shell: process.platform === "win32" ? undefined : "/bin/bash" }, (err) =>
err ? reject(err) : resolve(),
); );
}); });