Skip to content

Commit 096986f

Browse files
committed
fix(scoop): dynamically patch Get-ExecutionPolicy calls in scoop installer to prevent GHA crashes
1 parent 0579264 commit 096986f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Services/Bootstrappers/ScoopBootstrapper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public void Install(bool dryRun)
4848
return;
4949
}
5050

51-
// Use -ExecutionPolicy Bypass as a process argument instead of calling Set-ExecutionPolicy cmdlet inline
52-
string command = "irm get.scoop.sh -outfile install.ps1; .\\install.ps1 -RunAsAdmin; if (Test-Path .\\install.ps1) { Remove-Item .\\install.ps1 }";
51+
// Use -ExecutionPolicy Bypass as a process argument and dynamically patch Get-ExecutionPolicy calls in the script to avoid runner module-loading crashes
52+
string command = "irm get.scoop.sh -outfile install.ps1; (Get-Content install.ps1) -replace 'Get-ExecutionPolicy', '\"RemoteSigned\"' | Set-Content install.ps1; .\\install.ps1 -RunAsAdmin; if (Test-Path .\\install.ps1) { Remove-Item .\\install.ps1 }";
5353

5454
for (int attempt = 0; attempt < MaxRetries; attempt++)
5555
{

0 commit comments

Comments
 (0)