From 9b77483a815d5778fe19c600de43ed9fd5b8d8dc Mon Sep 17 00:00:00 2001 From: Matt Wrock Date: Sun, 11 Jan 2015 21:11:16 -0800 Subject: [PATCH] reference chocolateyErrored from script scope in chocolatey.ps1 in case chocolatey is intercepted from a module (like boxstarter) --- src/chocolatey.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/chocolatey.ps1 b/src/chocolatey.ps1 index 6b3f7e5..76c7a17 100644 --- a/src/chocolatey.ps1 +++ b/src/chocolatey.ps1 @@ -166,7 +166,7 @@ if ($forceX86) { $env:chocolateyPackageParameters = $packageParameters -$chocolateyErrored = $false +$script:chocolateyErrored = $false $badPackages = '' #todo: This does not catch package names that come later @@ -193,7 +193,7 @@ foreach ($packageName in $packageNames) { } } catch { - $chocolateyErrored = $true + $script:chocolateyErrored = $true Write-Host "$($_.Exception.Message)" -BackgroundColor $ErrorColor -ForegroundColor White ; if ($badPackages -ne '') { $badPackages += ', '} $badPackages += "$packageName" @@ -208,7 +208,7 @@ if ($badPackages -ne '') { Write-Host "Command `'$command`' failed (sometimes this indicates a partial failure). Additional info/packages: $badpackages" -BackgroundColor $ErrorColor -ForegroundColor White } -if ($chocolateyErrored) { +if ($script:chocolateyErrored) { Write-Debug "Exiting with non-zero exit code." exit 1 }