1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-23 04:20:09 +00:00

fix(windows): bypass installer execution policy

Refs #612
This commit is contained in:
Tw93
2026-03-21 19:19:57 +08:00
parent 746bb2c956
commit 982aa6ecb2
4 changed files with 30 additions and 14 deletions

View File

@@ -80,6 +80,18 @@ function Invoke-GitCommand {
}
}
function Get-PowerShellCommand {
if (Get-Command powershell.exe -ErrorAction SilentlyContinue) {
return "powershell.exe"
}
if (Get-Command pwsh -ErrorAction SilentlyContinue) {
return "pwsh"
}
throw "PowerShell executable not found"
}
# Main installation
try {
Write-Host ""
@@ -150,7 +162,11 @@ try {
Write-Step "Running installer..."
Write-Host ""
& (Join-Path $InstallDir "install.ps1") -InstallDir $InstallDir -AddToPath
$powerShellCommand = Get-PowerShellCommand
& $powerShellCommand -NoLogo -NoProfile -ExecutionPolicy Bypass -File (Join-Path $InstallDir "install.ps1") -InstallDir $InstallDir -AddToPath
if ($LASTEXITCODE -ne 0) {
throw "Installer exited with code $LASTEXITCODE"
}
Write-Host ""
Write-Success "Installation complete!"