Skip to content

Commit

Permalink
Merge pull request #796 from LittleboyHarry/patch-1
Browse files Browse the repository at this point in the history
Fixed non-ascii git branch name garbled.
  • Loading branch information
dahlbyk authored Oct 2, 2020
2 parents 3a9f44d + 3d212c7 commit d94feed
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/Utils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,13 @@ function Invoke-Utf8ConsoleCommand([ScriptBlock]$cmd) {
# A native executable that writes to stderr AND has its stderr redirected will generate non-terminating
# error records if the user has set $ErrorActionPreference to Stop. Override that value in this scope.
$ErrorActionPreference = 'Continue'
if ($currentEncoding.IsSingleByte) {
try { [Console]::OutputEncoding = [Text.Encoding]::UTF8 } catch [System.IO.IOException] {}
}

try { [Console]::OutputEncoding = [Text.Encoding]::UTF8 } catch [System.IO.IOException] {}
& $cmd
}
finally {
if ($currentEncoding.IsSingleByte) {
try { [Console]::OutputEncoding = $currentEncoding } catch [System.IO.IOException] {}
}

try { [Console]::OutputEncoding = $currentEncoding } catch [System.IO.IOException] {}

# Clear out stderr output that was added to the $Error collection, putting those errors in a module variable
if ($global:Error.Count -gt $errorCount) {
$numNewErrors = $global:Error.Count - $errorCount
Expand Down

0 comments on commit d94feed

Please sign in to comment.