From bf49b460d84fce03bac02464b0a9922a1348adc7 Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Wed, 17 Apr 2024 11:07:02 +0100 Subject: [PATCH] Check if PSReadline is installed first --- roles/home-cli/files/Microsoft.PowerShell_profile.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 b/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 index c76ad80..0390a89 100644 --- a/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 +++ b/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 @@ -87,7 +87,7 @@ Remove-Variable -Name nvim $OutputEncoding = [System.Text.Encoding]::UTF8 # Try upgrading the default version of PSReadLine to something newer. -if ((Get-Module PSReadline).Version -le [Version]"2.0.0.0") { +if ($null -ne (Get-Module PSReadline).Version -and (Get-Module PSReadline).Version -le [Version]"2.0.0.0") { try { Write-Host "PSReadLine <= 2.0.0.0. Trying to upgrade..." Install-Module -Scope CurrentUser -Name PSReadLine -Force -ErrorAction SilentlyContinue