Fixed choco outdated command to not use $LASTEXITCODE and instead check if NULL
This commit is contained in:
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,19 +1,11 @@
|
|||||||
# Chocolatey-tools Release History
|
# Chocolatey-tools Release History
|
||||||
|
|
||||||
## Version Number - Release Date
|
## 0.4.3 - 6/5/2019
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
* First item fixed
|
* Get-ChocoOutdatedPackages was failing due to change in $LASTEXITCODE handling in latest
|
||||||
|
Chocolatey version (0.10.15)
|
||||||
* Second item fixed
|
* Second item fixed
|
||||||
|
|
||||||
### Added
|
|
||||||
|
|
||||||
* New item added
|
|
||||||
* Another new item added
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
|
|
||||||
* Feature changed
|
|
||||||
* Tests added
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
RootModule = 'Chocolatey-tools.psm1'
|
RootModule = 'Chocolatey-tools.psm1'
|
||||||
|
|
||||||
# Version number of this module.
|
# Version number of this module.
|
||||||
ModuleVersion = '0.4.2'
|
ModuleVersion = '0.4.3'
|
||||||
|
|
||||||
# Supported PSEditions
|
# Supported PSEditions
|
||||||
# CompatiblePSEditions = @()
|
# CompatiblePSEditions = @()
|
||||||
|
|||||||
@@ -19,23 +19,18 @@ function Get-ChocoOutdatedPackages {
|
|||||||
)
|
)
|
||||||
Write-Verbose "Getting local outdated packages"
|
Write-Verbose "Getting local outdated packages"
|
||||||
$OutdatedPackages = (choco outdated -r --ignore-pinned --ignore-unfound --timeout=60)
|
$OutdatedPackages = (choco outdated -r --ignore-pinned --ignore-unfound --timeout=60)
|
||||||
if ($LASTEXITCODE -eq 1){
|
if (!($OutdatedPackages){
|
||||||
Write-Verbose -Message 'Error getting outdated packages'
|
Write-Verbose -Message 'No outdated packages'
|
||||||
$OutdatedPackages
|
|
||||||
Exit
|
|
||||||
}
|
|
||||||
if ($LASTEXITCODE -eq 0){
|
|
||||||
Write-Verbose -Message 'No new packages available. Exiting'
|
|
||||||
Exit
|
Exit
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
foreach ($NewPackage in $OutdatedPackages){
|
foreach ($NewPackage in $OutdatedPackages){
|
||||||
[PSCustomObject]@{
|
[PSCustomObject]@{
|
||||||
Name = $NewPackage.Split('|')[0]
|
Name = $NewPackage.Split('|')[0]
|
||||||
CurrentVersion = $NewPackage.Split('|')[1]
|
CurrentVersion = $NewPackage.Split('|')[1]
|
||||||
Version = $NewPackage.Split('|')[2]
|
Version = $NewPackage.Split('|')[2]
|
||||||
Pinned = $NewPackage.Split('|')[3]
|
Pinned = $NewPackage.Split('|')[3]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user