Fix Error message with GH and GIT (#3312)
Co-authored-by: freddydk <freddydk@users.noreply.github.com>
This commit is contained in:
Родитель
a5980362e7
Коммит
40f7c4a535
|
@ -27,7 +27,7 @@ function invoke-gh {
|
|||
$arguments += "$parameter "
|
||||
}
|
||||
}
|
||||
cmdDo -command gh -arguments $arguments -silent:$silent -returnValue:$returnValue -inputStr $inputStr
|
||||
cmdDo -command gh -arguments $arguments -silent:$silent -returnValue:$returnValue -inputStr $inputStr -messageIfCmdNotFound "Github CLI not found. Please install it from https://cli.github.com/"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ function invoke-git {
|
|||
$arguments += "$parameter "
|
||||
}
|
||||
}
|
||||
cmdDo -command git -arguments $arguments -silent:$silent -returnValue:$returnValue -inputStr $inputStr
|
||||
cmdDo -command git -arguments $arguments -silent:$silent -returnValue:$returnValue -inputStr $inputStr -messageIfCmdNotFound "Git not found. Please install it from https://git-scm.com/downloads"
|
||||
}
|
||||
}
|
||||
Export-ModuleMember -Function Invoke-git
|
||||
|
|
|
@ -97,7 +97,8 @@ function CmdDo {
|
|||
[string] $arguments = "",
|
||||
[switch] $silent,
|
||||
[switch] $returnValue,
|
||||
[string] $inputStr = ""
|
||||
[string] $inputStr = "",
|
||||
[string] $messageIfCmdNotFound = ""
|
||||
)
|
||||
|
||||
$oldNoColor = "$env:NO_COLOR"
|
||||
|
@ -105,7 +106,6 @@ function CmdDo {
|
|||
$oldEncoding = [Console]::OutputEncoding
|
||||
try { [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 } catch {}
|
||||
try {
|
||||
$result = $true
|
||||
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
|
||||
$pinfo.FileName = $command
|
||||
$pinfo.RedirectStandardError = $true
|
||||
|
@ -151,6 +151,19 @@ function CmdDo {
|
|||
throw $message
|
||||
}
|
||||
}
|
||||
catch [System.ComponentModel.Win32Exception] {
|
||||
if ($_.Exception.NativeErrorCode -eq 2) {
|
||||
if ($messageIfCmdNotFound) {
|
||||
throw $messageIfCmdNotFound
|
||||
}
|
||||
else {
|
||||
throw "Command $command not found, you might need to install that command."
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw
|
||||
}
|
||||
}
|
||||
finally {
|
||||
try { [Console]::OutputEncoding = $oldEncoding } catch {}
|
||||
$env:NO_COLOR = $oldNoColor
|
||||
|
|
|
@ -307,7 +307,7 @@ class NuGetFeed {
|
|||
Write-Host "Verifying package using $($this.fingerprints -join ', ')"
|
||||
$arguments += @("--certificate-fingerprint $($this.fingerprints -join ' --certificate-fingerprint ')")
|
||||
}
|
||||
cmddo -command 'dotnet' -arguments $arguments -silent
|
||||
cmddo -command 'dotnet' -arguments $arguments -silent -messageIfCmdNotFound "dotnet not found. Please install it from https://dotnet.microsoft.com/download"
|
||||
}
|
||||
Expand-Archive -Path $filename -DestinationPath $tmpFolder -Force
|
||||
$global:ProgressPreference = $prev
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
6.0.5
|
||||
Give better error message if GitHub CLI, GIT or dotnet is not installed
|
||||
Issue 3301 Run-AlValidation fails running AppsourceCop "Could not load type 'System.Object' from assembly 'System.Private.CoreLib' (Regression in 6.0.4)
|
||||
Issue 3313 Strange error in Copy-BcEnvironment
|
||||
|
||||
6.0.4
|
||||
|
|
Загрузка…
Ссылка в новой задаче