fix: use PowerShell for Windows auto-update extraction
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
25543cb7ba
commit
fb9d583c71
1 changed files with 7 additions and 4 deletions
|
|
@ -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(),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue