Skip to content

Commit

Permalink
chocolatey-visualstudio.extension: give specific VS installer process…
Browse files Browse the repository at this point in the history
…es some time to exit

GitHub-Issue: GH-13
  • Loading branch information
jberezanski committed May 15, 2018
1 parent 8a72da5 commit b2666e1
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,22 @@ function Wait-VSInstallerProcesses

$exitCode = $null

Write-Debug 'Looking for still running VS installer processes'
$lazyQuitterProcessNames = @('vs_installershell', 'vs_installerservice')
$lazyQuitterProcesses = Get-Process -Name $lazyQuitterProcessNames -ErrorAction SilentlyContinue
$lazyQuitterProcessCount = ($lazyQuitterProcesses | Measure-Object).Count
if ($lazyQuitterProcessCount -gt 0)
{
Write-Debug "Found $lazyQuitterProcessCount still running Visual Studio installer processes which are known to exit asynchronously:"
$lazyQuitterProcesses | Sort-Object -Property Name, Id | ForEach-Object { '[{0}] {1}' -f $_.Id, $_.Name } | Write-Debug
Write-Debug 'Giving the processes some time to exit'
Start-Sleep -Seconds 1000
Write-Debug 'Looking for still running VS installer processes'
}

# This sometimes happens when the VS installer is updated by the invoked bootstrapper.
# The initial process exits, leaving another instance of the VS installer performing the actual install in the background.
# This happens despite passing '--wait'.
Write-Debug 'Looking for still running VS installer processes'
$vsInstallerProcessNames = @('vs_bootstrapper', 'vs_setup_bootstrapper', 'vs_installer', 'vs_installershell', 'vs_installerservice')
$vsInstallerProcesses = Get-Process -Name $vsInstallerProcessNames -ErrorAction SilentlyContinue
$vsInstallerProcessCount = ($vsInstallerProcesses | Measure-Object).Count
Expand Down

0 comments on commit b2666e1

Please sign in to comment.