Skip to content

Commit d94feed

Browse files
authored
Merge pull request #796 from LittleboyHarry/patch-1
Fixed non-ascii git branch name garbled.
2 parents 3a9f44d + 3d212c7 commit d94feed

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/Utils.ps1

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,13 @@ function Invoke-Utf8ConsoleCommand([ScriptBlock]$cmd) {
3232
# A native executable that writes to stderr AND has its stderr redirected will generate non-terminating
3333
# error records if the user has set $ErrorActionPreference to Stop. Override that value in this scope.
3434
$ErrorActionPreference = 'Continue'
35-
if ($currentEncoding.IsSingleByte) {
36-
try { [Console]::OutputEncoding = [Text.Encoding]::UTF8 } catch [System.IO.IOException] {}
37-
}
35+
36+
try { [Console]::OutputEncoding = [Text.Encoding]::UTF8 } catch [System.IO.IOException] {}
3837
& $cmd
3938
}
4039
finally {
41-
if ($currentEncoding.IsSingleByte) {
42-
try { [Console]::OutputEncoding = $currentEncoding } catch [System.IO.IOException] {}
43-
}
44-
40+
try { [Console]::OutputEncoding = $currentEncoding } catch [System.IO.IOException] {}
41+
4542
# Clear out stderr output that was added to the $Error collection, putting those errors in a module variable
4643
if ($global:Error.Count -gt $errorCount) {
4744
$numNewErrors = $global:Error.Count - $errorCount

0 commit comments

Comments
 (0)