diff --git a/eng/pipeline/stages/run-stage.yml b/eng/pipeline/stages/run-stage.yml index 3417f81589e..6020df61672 100644 --- a/eng/pipeline/stages/run-stage.yml +++ b/eng/pipeline/stages/run-stage.yml @@ -198,10 +198,23 @@ stages: $env:PATH -split ';' | Where-Object { $_ -ne 'C:\Program Files\Git\usr\bin' } ) -join ';' + function RemovePathBinary($name) { + $src = (Get-Command $name -ErrorAction SilentlyContinue).Source + if ($src) { + Write-Host "Removing $src" + Remove-Item $src + } else { + Write-Host "Command not found: $name" + } + } + + Write-Host "Removing pkg-config to skip cmd/go TestScript/list_pkgconfig_error on Windows." + RemovePathBinary 'pkg-config' + Write-Host "Removing Chocolatey shim for SWIG to avoid running misc SWIG tests that would fail." # The Chocolatey shims are located in a single folder in PATH, so we can't change PATH to exclude it. # Upstream Windows builders don't have SWIG installed, so this makes coverage even. - Remove-Item (Get-Command swig).Source + RemovePathBinary 'swig' } eng/run.ps1 cmdscan -envprefix GO_CMDSCAN_RULE_ -- `