File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,23 +105,28 @@ $guid = [System.Guid]::NewGuid()
105105$tempInstallDirectory = Join-Path $tmp " azsdk-install-$ ( $guid ) "
106106
107107# If already installed, use first class version mechanism
108- $azsdkCmd = Get-Command - ErrorAction SilentlyContinue $packageName
108+ $azsdkCmd = Get-Command - ErrorAction Ignore $packageName
109109if ($azsdkCmd -and ! $InstallDirectory ) {
110110 $ErrorActionPreference = " Stop"
111111 $upgrade = & $packageName upgrade -- check -- output json | out-string
112112 if (! $LASTEXITCODE ) {
113113 $ErrorActionPreference = ' Ignore'
114114 $localVersion = $upgrade | ConvertFrom-Json - AsHashtable
115115 $ErrorActionPreference = ' Stop'
116- if ($localVersion.old_version -and $localVersion.old_version -eq ($Version ? $Version : $localVersion.new_version )) {
116+ if ($localVersion -and $localVersion .old_version -and $localVersion.old_version -eq ($Version ? $Version : $localVersion.new_version )) {
117117 log " Version up to date at $ ( $localVersion.old_version ) "
118118 if ($Run ) {
119119 $proc = Start-Process - PassThru - WorkingDirectory $RunDirectory - FilePath $azsdkCmd.Path - ArgumentList ' mcp' - NoNewWindow - Wait
120120 exit $proc.ExitCode
121121 }
122122 exit 0
123123 }
124- log " Version not up to date at " + $localVersion.old_version
124+ if ($localVersion ) {
125+ log " Version not up to date at " + $localVersion.old_version
126+ } else {
127+ log " Failed to parse version:"
128+ log $upgrade
129+ }
125130 }
126131}
127132
You can’t perform that action at this time.
0 commit comments