Skip to content

Commit 8c8e5e7

Browse files
committed
Use PowerShell Expand-Archive on Windows postinstall
1 parent d2ab02d commit 8c8e5e7

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

install.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ async function install() {
7979
if (ext === 'tar.gz') {
8080
execSync(`tar -xzf "${archivePath}" -C "${binDir}"`, { stdio: 'ignore' });
8181
} else {
82-
execSync(`unzip -o "${archivePath}" -d "${binDir}"`, { stdio: 'ignore' });
82+
// Windows doesn't ship with `unzip`. PowerShell's Expand-Archive is
83+
// built into Windows 10+ and Windows Server 2016+.
84+
const psCmd = `Expand-Archive -Force -Path '${archivePath.replace(/'/g, "''")}' -DestinationPath '${binDir.replace(/'/g, "''")}'`;
85+
execSync(`powershell -NoProfile -NonInteractive -Command "${psCmd}"`, { stdio: 'ignore' });
8386
}
8487

8588
const binaryPath = path.join(binDir, binaryName);

0 commit comments

Comments
 (0)