New implementation of pseudo console support (experimental)

Takashi Yano
Tue May 26 01:00:54 GMT 2020

On Mon, 25 May 2020 17:22:04 +0200
Corinna Vinschen wrote:
> Works fine for me, but I have only a limited test scenario.

Thank you very much for testing.

> In terms of the remaining disadvantages:
> 3) The cygwin program which call console API directly does not work.
>   I don't see a problem here.

If the code below is compiled with cygwin gcc, it does not work.

#include <windows.h>
int main()
  WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "AAA\r\n", 5, NULL, 0);
  return 0;

However, this does not work also in cygwin 3.0.7, so it does not
matter for the app which works in cygwin 3.0.7.

> 4) The apps which use console API cannot be debugged with gdb.
>   Do you mean Cygwin apps or native apps?  I assume native apps
>   because of disadvantage 3...

I mean native apps. If the process is executed by gdb, pseudo
console is not activated since gdb use CreateProcess() rather
than exec().

>   Does that mean you can't even debug by attaching (via PID)?

Attaching gdb to native apps, in which pseudo console is
already activated, should work.

> 5) Type ahead key inputs are discarded while native console app is
>    executed.
>   Hmm, not muchg of a problem, I think.
> 7) Code page cannot be changed by
>   I fail to see the exact drawback here.  I don't think a lot of users
>   use chcp, but of course I could be wrong.  I'd also be curious why
>   chcp doesn't work.

Please note that pseudo console is created for each native 
console app in this implementation. Acctually, chcp works
itself and changes code page of its own pseudo console.
However, since pseudo console is recreated for another
process, which does not inherit the code page.

Takashi Yano <>

More information about the Cygwin-developers mailing list