зеркало из https://github.com/dotnet/pinvoke.git
Merge pull request #58 from AArnott/fix57
Avoid unannounced system restart
This commit is contained in:
Коммит
c4a24d10ec
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"sdk": {
|
||||
"version": "3.1.300",
|
||||
"version": "3.1.301",
|
||||
"rollForward": "patch",
|
||||
"allowPrerelease": false
|
||||
}
|
||||
|
|
3
init.ps1
3
init.ps1
|
@ -44,6 +44,9 @@ $EnvVars = @{}
|
|||
if (!$NoPrerequisites) {
|
||||
& "$PSScriptRoot\tools\Install-NuGetCredProvider.ps1" -AccessToken $AccessToken -Force:$UpgradePrerequisites
|
||||
& "$PSScriptRoot\tools\Install-DotNetSdk.ps1" -InstallLocality $InstallLocality
|
||||
if ($LASTEXITCODE -eq 3010) {
|
||||
Exit 3010
|
||||
}
|
||||
|
||||
# The procdump tool and env var is required for dotnet test to collect hang/crash dumps of tests.
|
||||
# But it only works on Windows.
|
||||
|
|
|
@ -77,8 +77,10 @@ Function Install-DotNet($Version, [switch]$Runtime) {
|
|||
Write-Host "Downloading .NET Core $sdkSubstring$Version..."
|
||||
$Installer = Get-InstallerExe -Version $Version -Runtime:$Runtime
|
||||
Write-Host "Installing .NET Core $sdkSubstring$Version..."
|
||||
cmd /c start /wait $Installer /install /quiet
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
cmd /c start /wait $Installer /install /passive /norestart
|
||||
if ($LASTEXITCODE -eq 3010) {
|
||||
Write-Verbose "Restart required"
|
||||
} elseif ($LASTEXITCODE -ne 0) {
|
||||
throw "Failure to install .NET Core SDK"
|
||||
}
|
||||
}
|
||||
|
@ -95,16 +97,24 @@ if ($InstallLocality -eq 'machine') {
|
|||
if ($IsMacOS -or $IsLinux) {
|
||||
$DotNetInstallDir = '/usr/share/dotnet'
|
||||
} else {
|
||||
$restartRequired = $false
|
||||
if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) {
|
||||
Install-DotNet -Version $sdkVersion
|
||||
$restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010)
|
||||
}
|
||||
|
||||
$runtimeVersions | Get-Unique |% {
|
||||
if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) {
|
||||
Install-DotNet -Version $_ -Runtime
|
||||
$restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010)
|
||||
}
|
||||
}
|
||||
|
||||
if ($restartRequired) {
|
||||
Write-Host -ForegroundColor Yellow "System restart required"
|
||||
Exit 3010
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
} elseif ($InstallLocality -eq 'repo') {
|
||||
|
|
Загрузка…
Ссылка в новой задаче