Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PowerShellForGitHub: Disable Progress Bar for Invoke-WebRequest #229

Merged
merged 6 commits into from
Jun 10, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions GitHubCore.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,12 @@ function Invoke-GHRestMethod
}
}

# Disable Progress Bar in function scope during Invoke-WebRequest
$ProgressPreference = 'SilentlyContinue'

[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12
$result = Invoke-WebRequest @params

if ($Method -eq 'Delete')
{
Write-Log -Message "Successfully removed." -Level Verbose
Expand Down Expand Up @@ -265,6 +269,9 @@ function Invoke-GHRestMethod

try
{
# Disable Progress Bar in function scope during Invoke-WebRequest
$ProgressPreference = 'SilentlyContinue'

[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12
Invoke-WebRequest @params
}
Expand Down
6 changes: 6 additions & 0 deletions Telemetry.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ function Invoke-SendTelemetryEvent
$params.Add("TimeoutSec", (Get-GitHubConfiguration -Name WebRequestTimeoutSec))
$params.Add("Body", $bodyAsBytes)

# Disable Progress Bar in function scope during Invoke-WebRequest
$ProgressPreference = 'SilentlyContinue'

$result = Invoke-WebRequest @params
}
}
Expand Down Expand Up @@ -211,6 +214,9 @@ function Invoke-SendTelemetryEvent

try
{
# Disable Progress Bar in function scope during Invoke-WebRequest
$ProgressPreference = 'SilentlyContinue'

Invoke-WebRequest @params
}
catch [System.Net.WebException]
Expand Down