Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5091ff3

Browse files
committed
Version match doesn't work on Linux
1 parent b2fe54b commit 5091ff3

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

vscode-powershell.build.ps1

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,7 @@ function Assert-Pwsh ([Version]$RequiredPowerShellVersion) {
5050
Write-Host -Fore Magenta "pwsh which: $(which pwsh)"
5151
}
5252
Write-Host -Fore Magenta "pwsh command: $(Get-Command pwsh)"
53-
$pwsh = (Get-Command -Name pwsh -CommandType Application -ErrorAction Stop)
54-
| Sort-Object Version -Descending
55-
| Select-Object -First 1
56-
if (-not $pwsh) {
57-
throw [NotImplementedException]'Pwsh not found but automatic installation is not yet supported.'
58-
}
59-
[Version]$pwshVersion = $pwsh.Version
53+
[Version]$pwshVersion = (& pwsh -v) -replace '^PowerShell '
6054
} catch {
6155
if ($InstallPrerequisites) {
6256
throw [NotImplementedException]"Pwsh not found but automatic installation is not yet supported. Error: $PSItem"
@@ -66,7 +60,7 @@ function Assert-Pwsh ([Version]$RequiredPowerShellVersion) {
6660
}
6761
if ($pwshVersion -lt $RequiredPowerShellVersion) {
6862
if ($InstallPrerequisites) {
69-
throw [NotImplementedException]"Pwsh $pwshVersion less than $requiredPowershell Version but Automatic installation of Pwsh is not yet supported."
63+
throw [NotImplementedException]"Pwsh $pwshVersion less than $requiredPowershellVersion Version but Automatic installation of Pwsh is not yet supported."
7064
}
7165
Write-Error "PowerShell version $pwshVersion is not or no longer supported. Please install PowerShell $RequiredPowerShellVersion or higher. $PSItem"
7266
return

0 commit comments

Comments
 (0)