diff --git a/CHANGELOG.md b/CHANGELOG.md index fecb9eef35..14b7b0e08f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - **commands**: Handling broken aliases ([#6141](https://github.com/ScoopInstaller/Scoop/issues/6141)) - **shim:** Do not suppress `stderr`, properly check `wslpath`/`cygpath` command first ([#6114](https://github.com/ScoopInstaller/Scoop/issues/6114)) - **scoop-bucket:** Add missing import for `no_junction` envs ([#6181](https://github.com/ScoopInstaller/Scoop/issues/6181)) +- **shim:** Don't throw if command was not found ([#6206](https://github.com/ScoopInstaller/Scoop/issues/6206)) ### Code Refactoring diff --git a/libexec/scoop-shim.ps1 b/libexec/scoop-shim.ps1 index 877b65b2e9..b6be41e5d7 100644 --- a/libexec/scoop-shim.ps1 +++ b/libexec/scoop-shim.ps1 @@ -76,7 +76,7 @@ function Get-ShimInfo($ShimPath) { $info.Alternatives = (@($info.Source) + ($altShims | ForEach-Object { $_.Extension.Remove(0, 1) } | Select-Object -Unique)) -join ' ' } $info.IsGlobal = $ShimPath.StartsWith("$globalShimDir") - $info.IsHidden = !((Get-Command -Name $info.Name).Path -eq $info.Path) + $info.IsHidden = -not ((Get-Command -Name $info.Name -ErrorAction 'Ignore').Path -eq $info.Path) [PSCustomObject]$info }