Skip to content

Commit

Permalink
Fix Get-Command call
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeNaccarato committed Mar 12, 2024
1 parent 87de957 commit 703ccc1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .tools/sync.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ function Get-GlobalPython {
<#.SYNOPSIS
Get the global Python interpreter for a certain Python version.
#>
if (Get-Command 'py') {
if (Get-Command 'py' -ErrorAction Ignore) {
if (py --list | Select-String -Pattern "^\s?-V:$([Regex]::Escape($Version))") {
return "py -$Version"
}
}
elseif (Get-Command "python$Version") {
elseif (Get-Command "python$Version" -ErrorAction Ignore) {
return "python$Version"
}
Write-Warning "Python $Version does not appear to be installed. Download and install from 'https://www.python.org/downloads/'."
Expand Down

0 comments on commit 703ccc1

Please sign in to comment.