From 8a72da597854680e4a4e2082fae526931cf86d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Bere=C5=BCa=C5=84ski?= Date: Wed, 29 Nov 2017 21:34:37 +0100 Subject: [PATCH] chocolatey-visualstudio.extension: ignore null exit code when waiting for VS installer processes GitHub-Issue: GH-13 --- .../extensions/Wait-VSInstallerProcesses.ps1 | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/chocolatey-visualstudio.extension/extensions/Wait-VSInstallerProcesses.ps1 b/chocolatey-visualstudio.extension/extensions/Wait-VSInstallerProcesses.ps1 index 68490f3c..1929404d 100644 --- a/chocolatey-visualstudio.extension/extensions/Wait-VSInstallerProcesses.ps1 +++ b/chocolatey-visualstudio.extension/extensions/Wait-VSInstallerProcesses.ps1 @@ -37,7 +37,7 @@ function Wait-VSInstallerProcesses { $exitCode = $proc.ExitCode } - if ($proc.ExitCode -ne 0) + if ($proc.ExitCode -ne 0 -and $proc.ExitCode -ne $null) { Write-Warning "$($proc.Name) process $($proc.Id) exited with code $($proc.ExitCode)" if ($exitCode -eq 0) @@ -47,7 +47,14 @@ function Wait-VSInstallerProcesses } else { - Write-Debug "$($proc.Name) process $($proc.Id) exited with code $($proc.ExitCode)" + if ($proc.ExitCode -ne $null) + { + Write-Debug "$($proc.Name) process $($proc.Id) exited with code $($proc.ExitCode)" + } + else + { + Write-Debug "$($proc.Name) process $($proc.Id) exited, exit code unknown" + } } } } @@ -89,9 +96,9 @@ function Wait-VSInstallerProcesses { $exitCode = $proc.ExitCode } - if ($proc.ExitCode -ne 0) + if ($proc.ExitCode -ne 0 -and $proc.ExitCode -ne $null) { - Write-Warning "vs_installer.windows.exe process $($proc.Id) exited with code $($proc.ExitCode)" + Write-Warning "$($proc.Name) process $($proc.Id) exited with code $($proc.ExitCode)" if ($exitCode -eq 0) { $exitCode = $proc.ExitCode @@ -99,7 +106,14 @@ function Wait-VSInstallerProcesses } else { - Write-Debug "vs_installer.windows.exe process $($proc.Id) exited with code $($proc.ExitCode)" + if ($proc.ExitCode -ne $null) + { + Write-Debug "$($proc.Name) process $($proc.Id) exited with code $($proc.ExitCode)" + } + else + { + Write-Debug "$($proc.Name) process $($proc.Id) exited, exit code unknown" + } } } }