Problems with a combination of a mingw program, mintty, and CYGWIN=disable_pcon
André Bleau
andre_bleau@hotmail.com
Thu May 7 14:41:17 GMT 2020
Takashi Yano wrote:
________________________________________
Hi André,
Thanks for the report.
On Thu, 7 May 2020 03:38:25 +0000
André Bleau via Cygwin <cygwin@cygwin.com> wrote:
> Hi cygwin users,
>
> I have cli program that I run with mintty. It is a simple C++ program, reading from cin and outputing to cout. It is cross-compiled as a mingw program. I've been running it without problems fro over 2 years. Recently, I updated cygwin to 3.1.4-1 and noticed the pcon support. Since then, the output of my program has been messy: output lines have intermittent gaps in them. I made a simple test case that reproduces the problem, from the following simple C++ file, hello.cpp :
>
> #include <iostream>
> using namespace std;
> static string Green = "\033[32m";
> static string Yellow = "\033[33m";
> static string Reset = "\033[0m";
To use escape sequences in pseudo console, please add the following
code just like in normal cosole (command prompt).
#include <windows.h>
...
DWORD mode;
GetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), &mode);
mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), mode);
This should solve your problem.
--
Takashi Yano
________________________________________
Hi Takashi. Thanks for the quick response. Adding these lines of codes to my program and to the simple test case mentioned
solved the problem of gaps in lines when run from mintty with pcon enabled.
However, it does not solve the problem of mintty misbehavior when started from a bash script to run the same program.
Maybe this is a problem that Thomas Wolf would be interested in.
Regards,
- André Bleau
More information about the Cygwin
mailing list