File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -32,16 +32,13 @@ function Invoke-Utf8ConsoleCommand([ScriptBlock]$cmd) {
32
32
# A native executable that writes to stderr AND has its stderr redirected will generate non-terminating
33
33
# error records if the user has set $ErrorActionPreference to Stop. Override that value in this scope.
34
34
$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 ] {}
38
37
& $cmd
39
38
}
40
39
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
+
45
42
# Clear out stderr output that was added to the $Error collection, putting those errors in a module variable
46
43
if ($global :Error.Count -gt $errorCount ) {
47
44
$numNewErrors = $global :Error.Count - $errorCount
You can’t perform that action at this time.
0 commit comments