* Fixes a regression [introduced by #242 unfortunately](17f6122d78 (diff-34a614678760cc83c5a91ad95ae240e5R86)) when I was reducing the lines in the module that exceeded 100 chars.

Specifically (note the `=Message` instead of the `-Message`):
17f6122d78/UpdateCheck.ps1 (L86)

* Updates the web request to suppress the progress bar using `$ProgressPreference = 'SilentlyContinue'`

* Adds a `-Force` switch to force the update check to happen again to make future debugging scenarios easier.

Fixes #249
Fixes #250
This commit is contained in:
Howard Wolosky 2020-06-28 10:41:17 -07:00 коммит произвёл GitHub
Родитель eedfaa3740
Коммит d32bd11d97
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 22 добавлений и 2 удалений

Просмотреть файл

@ -26,13 +26,18 @@ function Invoke-UpdateCheck
The Git repo for this module can be found here: http://aka.ms/PowerShellForGitHub
.PARAMETER Force
For debugging purposes, using this switch will allow the check to occur more than the limit
of once per day. This _will not_ bypass the DisableUpdateCheck configuration value however.
.EXAMPLE
Invoke-UpdateCheck
.NOTES
Internal-only helper method.
#>
param()
[cmdletbinding()]
param([switch] $Force)
if (Get-GitHubConfiguration -Name DisableUpdateCheck)
{
@ -44,6 +49,18 @@ function Invoke-UpdateCheck
$jobNameToday = "Invoke-UpdateCheck-" + (Get-Date -format 'yyyyMMdd')
if ($Force)
{
if ($null -ne $script:UpdateCheckJobName)
{
# We're going to clear out the existing job and try running it again.
$null = Receive-Job -Name $script:UpdateCheckJobName -AutoRemoveJob -Wait -ErrorAction SilentlyContinue -ErrorVariable errorInfo
}
$script:UpdateCheckJobName = $null
$script:HasLatestVersion = $null
}
# We only check once per day
if ($jobNameToday -eq $script:UpdateCheckJobName)
{
@ -83,7 +100,7 @@ function Invoke-UpdateCheck
if ($script:HasLatestVersion)
{
$message = "[$moduleName] update check complete. Running latest version: $latestVersion"
Write-Log =Message $message -Level Verbose
Write-Log -Message $message -Level Verbose
}
elseif ($moduleVersion -gt $latestVersion)
{
@ -132,6 +149,9 @@ function Invoke-UpdateCheck
try
{
# Disable Progress Bar in function scope during Invoke-WebRequest
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest @params
}
catch