eric pouech (@epo) commented about programs/cmd/builtins.c:
}
if (output_is_console && output_CP) {
/* Convert text for current output code page and write to the console.
We don't use WriteFile here because that writes raw bytes, not characters. */
WCHAR *string;
count = WCMD_convert_text(output_CP, buffer, count, &string);
if (count) {
WriteConsoleW(hOut, string, count, &count, NULL);
free(string);
}
} else {
WriteFile(hOut, buffer, count, &count, NULL);
}
if (eof) {
break;
}
this still looks utterly ugly to me... * VerifyConsoleIoHandle (in native) doesn't detect all kinds of (new) conhost handles, use GetConsoleMode instead * I'll restart commenting this code when the MR is updated according to comments above (as it shall quite evolve)