mirror of
https://github.com/larksuite/cli.git
synced 2026-07-03 14:02:43 +08:00
fix: Fix installation errors when PowerShell is disabled by Group Policy. (#789)
This commit is contained in:
@@ -146,12 +146,17 @@ function extractZipWindows(archivePath, destDir) {
|
||||
"$ErrorActionPreference='Stop';" +
|
||||
"Expand-Archive -LiteralPath $env:LARK_CLI_ARCHIVE -DestinationPath $env:LARK_CLI_DEST -Force";
|
||||
execFileSync("powershell.exe", [...psOpts, cmdlet], { stdio: psStdio, env: psEnv });
|
||||
} catch (fallbackErr) {
|
||||
throw new Error(
|
||||
`Failed to extract ${archivePath}. ` +
|
||||
`.NET ZipFile attempt: ${primaryErr.message}. ` +
|
||||
`Expand-Archive fallback: ${fallbackErr.message}`
|
||||
);
|
||||
} catch (secondErr) {
|
||||
try {
|
||||
execFileSync("tar", ["-xf", archivePath, "-C", destDir], { stdio: psStdio });
|
||||
} catch (fallbackErr) {
|
||||
throw new Error(
|
||||
`Failed to extract ${archivePath}. ` +
|
||||
`.NET ZipFile attempt: ${primaryErr.message}. ` +
|
||||
`Expand-Archive fallback: ${secondErr.message}. ` +
|
||||
`tar fallback: ${fallbackErr.message}`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user