Skip to content
This repository has been archived by the owner on Feb 19, 2019. It is now read-only.

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
* stable:
  (GH-256) cpack/cpush always return 0 exit code even w/errors
  (maint) formatting
  (GH-516) Guard all Wait-Process if posh v3+
  Fix bogus error message with error code from 7za amiss
  (GH-514) Fix setting errored during install
  • Loading branch information
ferventcoder committed Jul 11, 2014
2 parents 3fb2007 + b354494 commit df8ba8f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/functions/Chocolatey-NuGet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Write-Debug "Installing packages to `"$nugetLibPath`"."
Write-Error "Package `'$installedPackageName v$installedPackageVersion`' did not install successfully: $($_.Exception.Message)"
if ($badPackages -ne '') { $badPackages += ', '}
$badPackages += "$packageName"
$chocolateyErrored = true
$chocolateyErrored = $true
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/functions/Chocolatey-Pack.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ param(

Write-Host "Calling `'$nugetExe $packageArgs`'."

Start-Process $nugetExe -ArgumentList $packageArgs -NoNewWindow -Wait -RedirectStandardOutput $logFile -RedirectStandardError $errorLogFile
$process = Start-Process $nugetExe -ArgumentList $packageArgs -NoNewWindow -Wait -RedirectStandardOutput $logFile -RedirectStandardError $errorLogFile -PassThru
if ($host.Version.Major -ge 3) { Wait-Process -InputObject $process }

$nugetOutput = Get-Content $logFile -Encoding Ascii
foreach ($line in $nugetOutput) {
Write-Host $line
}
$errors = Get-Content $errorLogFile
if ($errors -ne '') {
Write-Host $errors -BackgroundColor Red -ForegroundColor White
#throw $errors
if ($process.ExitCode -ne 0) {
throw $errors
}
}
8 changes: 4 additions & 4 deletions src/functions/Chocolatey-Push.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ param(

Write-Host "Calling `'$nugetExe $packageArgs`'. This may take a few minutes. Please wait for the command to finish." -ForegroundColor $Note -BackgroundColor Black

Start-Process $nugetExe -ArgumentList $packageArgs -NoNewWindow -Wait -RedirectStandardOutput $logFile -RedirectStandardError $errorLogFile
$process = Start-Process $nugetExe -ArgumentList $packageArgs -NoNewWindow -Wait -RedirectStandardOutput $logFile -RedirectStandardError $errorLogFile -PassThru
if ($host.Version.Major -ge 3) { Wait-Process -InputObject $process }

$nugetOutput = Get-Content $logFile -Encoding Ascii
foreach ($line in $nugetOutput) {
Write-Host $line -ForegroundColor $Note -BackgroundColor Black
}
$errors = Get-Content $errorLogFile
if ($errors -ne '') {
Write-Host $errors -BackgroundColor Red -ForegroundColor White
#throw $errors
if ($process.ExitCode -ne 0) {
throw $errors
}
}
21 changes: 11 additions & 10 deletions src/functions/Chocolatey-Python.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function Chocolatey-Python {
param(
[string] $packageName,
[string] $version ='',
[string] $packageName,
[string] $version ='',
[string] $installerArguments =''
)

Expand All @@ -14,19 +14,19 @@ param(
}

Chocolatey-InstallIfMissing 'easy.install'

Write-Host "Chocolatey (v$chocVer) is installing $packageName and dependencies (using Python). By installing you accept the license for $packageName and each dependency you are installing." -ForegroundColor $RunNote -BackgroundColor Black


$chocoInstallLog = Join-Path $nugetChocolateyPath 'chocolateyPythonInstall.log';
Append-Log $chocoInstallLog

$packageArgs = "/c easy_install $packageName"
if ($version -notlike '') {
Write-Debug "Adding version arguments `'$version`'"
$packageArgs = "/c easy_install $packageName==$version";
}

if ($installerArguments -ne '') {
Write-Debug "Adding installerArguments `'$installerArguments`'"
$packageArgs = "$packageArgs $installerArguments";
Expand All @@ -36,13 +36,14 @@ param(
#& cmd.exe $packagesArgs | Tee-Object -FilePath $chocoInstallLog

Write-Host "Opening minimized PowerShell window and calling `'cmd.exe $packageArgs`'. If progress is taking a long time, please check that window. It also may not be 100% silent..." -ForegroundColor $Warning -BackgroundColor Black
Start-Process -FilePath "$($env:windir)\System32\WindowsPowerShell\v1.0\powershell.exe" -ArgumentList "-NoProfile -ExecutionPolicy unrestricted -Command `"cmd.exe $packageArgs | Tee-Object -FilePath `'$chocoInstallLog`'`"" -Wait -WindowStyle Minimized

$process = Start-Process -FilePath "$($env:windir)\System32\WindowsPowerShell\v1.0\powershell.exe" -ArgumentList "-NoProfile -ExecutionPolicy unrestricted -Command `"cmd.exe $packageArgs | Tee-Object -FilePath `'$chocoInstallLog`'`"" -Wait -WindowStyle Minimized -PassThru
if ($host.Version.Major -ge 3) { Wait-Process -InputObject $process }

Create-InstallLogIfNotExists $chocoInstallLog
$installOutput = Get-Content $chocoInstallLog -Encoding Ascii
foreach ($line in $installOutput) {
Write-Host $line
}

Write-Host "Finished installing `'$packageName`' and dependencies - if errors not shown in console, none detected. Check log for errors if unsure." -ForegroundColor $RunNote -BackgroundColor Black
}
}
1 change: 1 addition & 0 deletions src/helpers/functions/Get-CheckSumValid.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ param(

Write-Debug "Calling command [`'$checksumExe`' -c$checksum `"$file`"] to retrieve checksum"
$process = Start-Process "$checksumExe" -ArgumentList " -c=`"$checksum`" -t=`"$checksumType`" -f=`"$file`"" -Wait -WindowStyle Hidden -PassThru
if ($host.Version.Major -ge 3) { Wait-Process -InputObject $process }

Write-Debug "`'$checksumExe`' exited with $($process.ExitCode)"

Expand Down
1 change: 1 addition & 0 deletions src/helpers/functions/Get-ChocolateyUnzip.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ param(
$unzipOps = {
param($7zip, $destination, $fileFullPath, [ref]$exitCodeRef)
$p = Start-Process $7zip -ArgumentList "x -o`"$destination`" -y `"$fileFullPath`"" -Wait -WindowStyle Hidden -PassThru
if ($host.Version.Major -ge 3) { Wait-Process -InputObject $p }
$exitCodeRef.Value = $p.ExitCode
}

Expand Down

0 comments on commit df8ba8f

Please sign in to comment.