8000 [Console] Restoring the ability to output unicode text to the Win10 c… · symfony/symfony@91a364c · GitHub
[go: up one dir, main page]

Skip to content

Commit 91a364c

Browse files
[Console] Restoring the ability to output unicode text to the Win10 console
Restoring the ability to output unicode text to the Win10 console after corrupting the console on line 224
1 parent 026286b commit 91a364c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Symfony/Component/Console/Terminal.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ private static function readFromProcess(string $command): ?string
157157
2 => ['pipe', 'w'],
158158
];
159159

160+
$cp = \function_exists('sapi_windows_cp_set') ? sapi_windows_cp_get() : 0;
161+
160162
$process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
161163
if (!\is_resource($process)) {
162164
return null;
@@ -167,6 +169,10 @@ private static function readFromProcess(string $command): ?string
167169
fclose($pipes[2]);
168170
proc_close($process);
169171

172+
if ($cp) {
173+
sapi_windows_cp_set($cp);
174+
}
175+
170176
return $info;
171177
}
172178
}

0 commit comments

Comments
 (0)
0