[Windows] Add retry to Install-VsixExtension (#6934)
This commit is contained in:
@@ -274,7 +274,7 @@ function Install-VsixExtension
|
|||||||
[string] $FilePath,
|
[string] $FilePath,
|
||||||
[Parameter(Mandatory = $true)]
|
[Parameter(Mandatory = $true)]
|
||||||
[string] $VSversion,
|
[string] $VSversion,
|
||||||
[int] $retries = 20,
|
[int] $Retries = 20,
|
||||||
[switch] $InstallOnly
|
[switch] $InstallOnly
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -285,6 +285,8 @@ function Install-VsixExtension
|
|||||||
|
|
||||||
$argumentList = ('/quiet', "`"$FilePath`"")
|
$argumentList = ('/quiet', "`"$FilePath`"")
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
Write-Host "Starting Install $Name..."
|
Write-Host "Starting Install $Name..."
|
||||||
$vsEdition = (Get-ToolsetContent).visualStudio.edition
|
$vsEdition = (Get-ToolsetContent).visualStudio.edition
|
||||||
try
|
try
|
||||||
@@ -322,8 +324,15 @@ function Install-VsixExtension
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Write-Host "Unsuccessful exit code returned by the installation process: $exitCode."
|
Write-Host "Unsuccessful exit code returned by the installation process: $exitCode."
|
||||||
exit 1
|
$Retries--
|
||||||
|
if ($Retries -eq 0) {
|
||||||
|
Write-Host "The $Name couldn't be installed after 20 attempts."
|
||||||
|
}else {
|
||||||
|
Write-Host "Waiting 10 seconds before retrying. Retries left: $Retries"
|
||||||
|
Start-Sleep -Seconds 10
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} until ($exitCode -eq 0 -or $exitCode -eq 1001 -or $Retries -eq 0 )
|
||||||
|
|
||||||
#Cleanup downloaded installation files
|
#Cleanup downloaded installation files
|
||||||
if (-not $InstallOnly)
|
if (-not $InstallOnly)
|
||||||
|
|||||||
Reference in New Issue
Block a user