Skip to content

Commit

Permalink
(chocolatey-archiveGH-128) PowerShell 1.x provider fixes for "else"
Browse files Browse the repository at this point in the history
Removed a line break which was causing installation issues with
1.x versions of the PowerShell provider  module. Older versions of
PowerShell, such as PowerShell v2, and the 1.x module do not
handle line breaks with else statements very well.
  • Loading branch information
mha74 authored and ferventcoder committed Jun 20, 2016
1 parent 461a0aa commit 75d7df6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions templates/InstallChocolatey.ps1.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ $chocErrorLog = Join-Path $tempDir "chocError.log"
# to the FileStream not being what is expected. Fixes "The OS handle's
# position is not what FileStream expected. Do not use a handle
# simultaneously in one FileStream and in Win32 code or another
# FileStream."
# FileStream."


# This only works with the ConsoleHost (PowerShell InternalHost)
function Fix-PowerShellOutputRedirectionBug {
Expand All @@ -55,7 +56,8 @@ function Fix-PowerShellOutputRedirectionBug {
$field2.SetValue($consoleHost, [Console]::Error)
} catch {
Write-Output "Unable to apply redirection fix. Error: $_"
}
}


}

Expand Down Expand Up @@ -99,8 +101,7 @@ $chocInstallPS1 = Join-Path $toolsFolder "chocolateyInstall.ps1"

if ($PSVersionTable.psversion.Major -gt 2) {
& $chocInstallPS1
}
else {
} else {
$output = Invoke-Expression $chocInstallPS1
$output
write-output "Any errors that occured during install or upgrade are logged here: $chocoErrorLog"
Expand Down

0 comments on commit 75d7df6

Please sign in to comment.