On Tuesday, 18 July 2023 at 21:31:54 UTC, Alexander Zhirov wrote:
    HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
WriteConsoleW(h_stderr, str.ptr, cast(DWORD)str.length, NULL, NULL);


If you checked the return value of this call, you'd find it fails since WriteConsole only works if the output is, in fact, a console.

You need to use WriteFile when it is redirected, which you can detect with GetFileType to see if it is a character device or not.

Reply via email to