* Problems with a combination of a mingw program, mintty, and CYGWIN=disable_pcon
@ 2020-05-07 3:38 André Bleau
2020-05-07 10:17 ` Takashi Yano
0 siblings, 1 reply; 3+ messages in thread
From: André Bleau @ 2020-05-07 3:38 UTC (permalink / raw)
To: cygwin
[-- Attachment #1: Type: text/plain, Size: 5704 bytes --]
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";
int main (int pArgc, char* pArgv[])
{
cout << "Hello!" << endl;
string answer;
do
{
cout << Yellow << "q to Quit, p to Print " << Reset;
cin >> answer;
cout << Yellow << "You answered: " << Reset << answer << endl;
if (answer[0] == 'p')
{
for (int i = 0; i < 30; ++i)
{
cout << Green << i << "\tA simple line of printing in green characters." << Reset << endl;
}
}
} while (answer[0] != 'q');
cout << "Goodbye." << endl;
return 0;
}
Compiled with:
x86_64-w64-mingw32-c++ -g hello.cpp -o hello -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic
When run in mintty, it prompts you to answer q or p . q quits the program, p prints 30 times the same line of green text.
With the new pcon support, often, everything is correct: 30 lines of green text are outputted correctly; but most of the time a few lines will have gaps in them or show a partial escape sequence, like this:
You answered: p
0 A simple line of printing in green characters.
1 A simple line of printing in green characters.
2 A simple line of printing in green characters.
3 A simple line of printing in green characters.
4 A simple line of printing in green characters.
5 A simple line of printing in green characters.
6 A simple line of printing in green characters.
7 A simple line of printing in green characters.
8 A simple line of printing in green characters.
9 A simple line of printing in green characters.
10 A simple line of printing in green characters.
11 A simple line of printing in green characters.
12 A simple line of printing in green characters.
13 A simple line of printing in green characters.
14 A simple line of printing in green characters.
15 A simple line of printing in green characters.
16 A simple line of printing in green characters.
17 A simple line of printing in green characters.
18 A simple line of printing in green characters.
19 A simple line of printing in green characters.
20 A simple line of printing in green characters.
21 A simple line of printing in green characters.
22 A simple line of printing in green characters.
23 A simple line of printing in green characters.
24 A simple line of printing in green characters.
25 A simple line of printing in green characters.
26 A simple line of printing in green characters.
27 A simple line of printing in green characters.
28 A simple line of printing in green characters.
[32m29 A simple line of printing in green characters.
q to Quit, p to Print p
You answered: p
0 A simple line of printing in green characters.
1 A simple line of printing in green characters.
2 A simple line of printing in green characters.
3 A simple line of printing in green characters.
4 A simple line of printing in green characters.
5 A simple line of printing in green characters.
6 A simple line of printing in green characters.
7 A simple line of printing in green characters.
8 A simple line of printing in green characters.
9 A simple line of printing in green characters.
10 A simple line of printing in green characters.
11 A simple line of printing in green characters.
12 A simple line of printing in green characters.
13 A simple line of printing in green characters.
14 A simple line of printing in green characters.
15 A simple line of printing in green characters.
16 A simple line of printing in green characters.
17 A simple line of printing in green characters.
18 A simple line of printing in green characters.
19 A simple line of printing in green characters.
20 A simple line of printing in green characters.
21 A simple line of printing in green characters.
22 A simple line of printing in green characters.
23 A simple line of printing in green characters.
24 A simple line of printing in green characters.
25 A simple line of printing in green characters.
26 A simple line of printing in green characters.
27 A simple line of printing in green characters.
28 A simple line of printing in green characters.
29 A simple line of printing in green characters.
q to Quit, p to Print q
If I start mintty with CYGWIN=disable_pcon and run the hello program in it, everything is fine and the program always outputs correctly, as it did before I updated cygwin.
CYGWIN=disable_pcon /usr/bin/mintty &
OK, no big deal then, I'll make a small bash script to automate this: hellobash
#/bin/bash
CYGWIN=disable_pcon /usr/bin/mintty absolutePath/hello.exe &
This is where it gets weird. Running ./hellobash sometimes gets the hello program run correctly. It accepts input and displays output as expected. But in about 1 in 5 runs, it will not accept input. A prompt is displayed, but no cursor is shown and typing produces nothing. ^C does not stop the program. Weirder: in about 1 in 20 to 30 runs, it's the converse: it will be stuck in a loop as if input was continuously feed to it, even if you don't type anything.
Output of cygcheck -c is attached.
Regards,
- André Bleau
[-- Attachment #2: cygcheck.out --]
[-- Type: application/octet-stream, Size: 29851 bytes --]
Cygwin Package Information
Package Version Status
_autorebase 001007-1 OK
adwaita-icon-theme 3.26.1-1 OK
alternatives 1.3.30c-10 OK
at-spi2-core 2.26.2-1 OK
autoconf 13-1 OK
autoconf2.1 2.13-12 OK
autoconf2.5 2.69-4 OK
automake 11-1 OK
automake1.10 1.10.3-3 OK
automake1.11 1.11.6-3 OK
automake1.12 1.12.6-3 OK
automake1.13 1.13.4-2 OK
automake1.14 1.14.1-3 OK
automake1.15 1.15.1-2 OK
automake1.16 1.16.1-1 OK
automake1.9 1.9.6-11 OK
base-cygwin 3.8-1 OK
base-files 4.3-2 OK
bash 4.4.12-3 OK
binutils 2.34+1git.de9c1b7cfe-1 OK
bzip2 1.0.8-1 OK
ca-certificates 2.40-1 OK
clisp 2.49-6.20150312hg15611 OK
cmake 3.14.5-1 OK
cmake-doc 3.14.5-1 OK
cmake-gui 3.14.5-1 OK
coreutils 8.26-2 OK
crypt 2.1-1 OK
crypto-policies 20190218-1 OK
csih 0.9.11-1 OK
cygport 0.33.1-1 OK
cygrunsrv 1.62-1 OK
cygutils 1.4.16-2 OK
cygwin 3.1.4-1 OK
cygwin-devel 3.1.4-1 OK
dash 0.5.9.1-1 OK
dconf-service 0.26.1-1 OK
dejavu-fonts 2.37-1 OK
desktop-file-utils 0.23-1 OK
diffstat 1.61-1 OK
diffutils 3.5-2 OK
dos2unix 7.4.1-1 OK
dri-drivers 19.1.6-1 OK
editrights 1.03-1 OK
file 5.32-1 OK
findutils 4.6.0-1 OK
gamin 0.1.10-15 OK
gawk 5.1.0-1 OK
gcc-core 9.3.0-2 OK
gcc-g++ 9.3.0-2 OK
gdb 9.1-1 OK
gdk-pixbuf2.0-svg 2.40.20-1 OK
getent 2.18.90-4 OK
git 2.21.0-1 OK
glib2.0-networking 2.54.1-1 OK
gnuplot 5.2.8-1 OK
grace 5.1.25-2 OK
grace-devel 5.1.25-2 OK
grep 3.0-2 OK
groff 1.22.4-1 OK
gsettings-desktop-schemas 3.24.1-1 OK
gtk-update-icon-cache 3.22.28-1 OK
gzip 1.8-1 OK
hicolor-icon-theme 0.15-1 OK
hostname 3.13-1 OK
icon-naming-utils 0.8.90-1 OK
info 6.7-1 OK
ipc-utils 1.0-2 OK
less 551-1 OK
lftp 4.9.1-1 OK
libamd1 2.4.4-1 OK
libarchive13 3.3.2-1 OK
libargp 20110921-3 OK
libarpack0 3.7.0-1 OK
libatk-bridge2.0_0 2.26.1-1 OK
libatk1.0_0 2.26.1-1 OK
libatomic1 9.3.0-2 OK
libatspi0 2.26.2-1 OK
libattr1 2.4.48-2 OK
libblkid1 2.33.1-2 OK
libboost_regex1.66 1.66.0-1 OK
libbrotlicommon1 1.0.7-1 OK
libbrotlidec1 1.0.7-1 OK
libbtf0 1.2.4-1 OK
libbz2_1 1.0.8-1 OK
libcairo2 1.16.0-1 OK
libcamd1 2.4.4-1 OK
libcbor 0.5.0-1 OK
libccolamd1 2.9.4-1 OK
libcerf1 1.13-1 OK
libcholmod1 3.0.9-1 OK
libcolamd1 2.9.4-1 OK
libcom_err2 1.44.5-1 OK
libcroco0.6_3 0.6.12-1 OK
libcrypt-devel 4.4.4-1 OK
libcrypt0 2.1-1 OK
libcrypt2 4.4.4-1 OK
libcurl4 7.66.0-1 OK
libcxsparse0 3.1.7-1 OK
libdatrie1 0.2.8-1 OK
libdb5.3 5.3.28-2 OK
libdbus1_3 1.10.22-1 OK
libedit0 20130712-1 OK
libepoxy0 1.4.3-1 OK
libexpat1 2.2.6-1 OK
libfam0 0.1.10-15 OK
libfdisk1 2.33.1-2 OK
libffi6 3.2.1-2 OK
libfftw3_3 3.3.8-1 OK
libfido2 1.3.0-2 OK
libFLAC8 1.3.2-1 OK
libfltk1.3 1.3.4-1 OK
libfontconfig-common 2.13.1-1 OK
libfontconfig1 2.13.1-1 OK
libfreetype6 2.9.1-1 OK
libgc1 8.0.4-1 OK
libgcc1 9.3.0-2 OK
libgd3 2.2.5-2 OK
libgdbm4 1.13-1 OK
libgdbm6 1.18.1-1 OK
libgdbm_compat4 1.18.1-1 OK
libgdk_pixbuf2.0_0 2.36.11-1 OK
libgfortran4 7.4.0-1 OK
libggi2 2.2.2-4 OK
libggiwmh0 0.3.2-4 OK
libgii1 1.0.2-4 OK
libGL1 19.1.6-1 OK
libgl2ps1 1.4.1-2 OK
libglapi0 19.1.6-1 OK
libglib2.0_0 2.54.3-1 OK
libglpk40 4.65-1 OK
libGLU1 9.0.1-1 OK
libgmp10 6.2.0-2 OK
libgnutls30 3.6.9-1 OK
libgomp1 9.3.0-2 OK
libGraphicsMagick++12 1.3.35-1 OK
libGraphicsMagick3 1.3.35-1 OK
libgraphite2_3 1.3.10-1 OK
libgsm1 1.0.17-1 OK
libgssapi_krb5_2 1.15.2-2 OK
libgtk3_0 3.22.28-1 OK
libguile2.0_22 2.0.14-3 OK
libguile2.2_1 2.2.7-1 OK
libharfbuzz0 2.5.3-1 OK
libhdf5_10 1.8.20-1 OK
libhdf5_101 1.10.2-1 OK
libhdf5_103 1.10.6-1 OK
libhdf5hl_10 1.8.20-1 OK
libhogweed4 3.4.1-1 OK
libICE6 1.0.10-1 OK
libiconv 1.14-3 OK
libiconv2 1.14-3 OK
libicu61 61.1-1 OK
libicu64 64.2-1 OK
libicu65 65.1-1 OK
libidn2_0 2.2.0-1 OK
libimagequant0 2.10.0-1 OK
libintl8 0.19.8.1-2 OK
libiodbc2 3.52.8-2 OK
libisl15 0.16.1-1 OK
libisl22 0.22.1-2 OK
libjasper4 2.0.14-1 OK
libjbig2 2.0-14 OK
libjpeg8 1.5.3-1 OK
libjson-glib1.0_0 1.4.2-1 OK
libjsoncpp19 1.8.4-1 OK
libk5crypto3 1.15.2-2 OK
libklu1 1.3.6-1 OK
libkrb5_3 1.15.2-2 OK
libkrb5support0 1.15.2-2 OK
liblapack0 3.9.0-2 OK
liblcms2_2 2.9-1 OK
libllvm8 8.0.1-1 OK
libltdl7 2.4.6-7 OK
liblz4_1 1.7.5-1 OK
liblzma5 5.2.4-1 OK
liblzo2_2 2.10-1 OK
libmetis0 5.1.0-1 OK
libmpc3 1.1.0-1 OK
libmpfr6 4.0.2-2p6 OK
libmysqlclient18 10.1.30-1 OK
libncursesw10 6.1-1.20190727 OK
libnetcdf11 4.4.1.1-1 OK
libnettle6 3.4.1-1 OK
libnghttp2_14 1.37.0-1 OK
libnsl2 1.2.0-1 OK
libogg0 1.3.1-1 OK
libopenblas 0.3.9-1 OK
libopenldap2_4_2 2.4.49-1 OK
libp11-kit0 0.23.20-1 OK
libpango1.0_0 1.40.14-1 OK
libpcre1 8.44-1 OK
libpcre2_16_0 10.34-1 OK
libpipeline1 1.5.1-1 OK
libpixman1_0 0.38.4-1 OK
libpkgconf3 1.6.3-1 OK
libpng16 1.6.37-1 OK
libpopt-common 1.16-2 OK
libpopt0 1.16-2 OK
libportaudio2 19.20140130-3 OK
libpq5 12.2-1 OK
libproxy1 0.4.14-2 OK
libpsl5 0.21.0-1 OK
libqhull_7 2019.1-1 OK
libqrupdate0 1.1.2-3 OK
libqscintilla2-qt5-common 2.10.2-1 OK
libqscintilla2_qt5-common 2.10.2-1 OK
libqscintilla2_qt5_13 2.10.2-1 OK
libQt5Core5 5.9.4-2 OK
libQt5Designer5 5.9.4-1 OK
libQt5Gui5 5.9.4-2 OK
libQt5Help5 5.9.4-1 OK
libQt5Sql5 5.9.4-2 OK
libQt5UiTools5 5.9.4-1 OK
libquadmath0 9.3.0-2 OK
libreadline7 7.0.3-3 OK
librest0.7_0 0.8.1-1 OK
librhash0 1.3.9-1 OK
librsvg2_2 2.40.20-1 OK
libsasl2_3 2.1.27-1 OK
libsigsegv2 2.10-2 OK
libSM6 1.2.3-1 OK
libsmartcols1 2.33.1-2 OK
libsndfile1 1.0.28-2 OK
libsoup-gnome2.4_1 2.60.3-1 OK
libsoup2.4_1 2.60.3-1 OK
libsource-highlight-common 3.1.8-6 OK
libsource-highlight4 3.1.8-6 OK
libsqlite3_0 3.30.0-1 OK
libssh-common 0.8.7-1 OK
libssh4 0.8.7-1 OK
libssl1.0 1.0.2t-1 OK
libssl1.1 1.1.1f-1 OK
libssp0 6.4.0-4 OK
libstdc++6 9.3.0-2 OK
libsuitesparseconfig1 4.5.1-1 OK
libsundials_ida2 2.7.0-1 OK
libsundials_nvecserial2 2.7.0-1 OK
libsybdb5 1.00.37-1 OK
libtasn1_6 4.14-1 OK
libthai0 0.1.26-1 OK
libtiff6 4.0.9-1 OK
libtirpc-common 1.1.4-1 OK
libtirpc3 1.1.4-1 OK
libtool 2.4.6-7 OK
libumfpack1 5.7.4-1 OK
libunistring2 0.9.10-1 OK
libuuid-devel 2.33.1-2 OK
libuuid1 2.33.1-2 OK
libuv1 1.32.0-1 OK
libvorbis 1.3.6-1 OK
libvorbis0 1.3.6-1 OK
libvorbisenc2 1.3.6-1 OK
libwebp7 0.6.1-2 OK
libwebpmux3 0.6.1-2 OK
libX11-xcb1 1.6.9-1 OK
libX11_6 1.6.9-1 OK
libXau6 1.0.9-1 OK
libxcb-glx0 1.14-1 OK
libxcb-icccm4 0.4.1-1 OK
libxcb-image0 0.4.0-1 OK
libxcb-keysyms1 0.4.0-1 OK
libxcb-randr0 1.14-1 OK
libxcb-render-util0 0.3.9-1 OK
libxcb-render0 1.14-1 OK
libxcb-shape0 1.14-1 OK
libxcb-shm0 1.14-1 OK
libxcb-sync1 1.14-1 OK
libxcb-util1 0.4.0-1 OK
libxcb-xfixes0 1.14-1 OK
libxcb-xinerama0 1.14-1 OK
libxcb-xkb1 1.14-1 OK
libxcb1 1.14-1 OK
libXcomposite1 0.4.5-1 OK
libXcursor1 1.2.0-1 OK
libXdamage1 1.1.5-1 OK
libXdmcp6 1.1.3-1 OK
libXext6 1.3.4-1 OK
libXfixes3 5.0.3-1 OK
libXft2 2.3.3-1 OK
libXi6 1.7.10-1 OK
libXinerama1 1.1.4-1 OK
libxkbcommon0 0.8.0-1 OK
libXm4 2.3.6-1 OK
libxml2 2.9.9-2 OK
libXmu6 1.1.3-1 OK
libXpm4 3.5.13-1 OK
libXrandr2 1.5.2-1 OK
libXrender1 0.9.10-1 OK
libXss1 1.2.3-1 OK
libXt6 1.2.0-1 OK
libXtst6 1.2.3-1 OK
lndir 1.0.3-1 OK
login 1.13-1 OK
lua 5.3.5-1 OK
m4 1.4.18-1 OK
make 4.3-1 OK
man-db 2.7.6.1-1 OK
mariadb-common 3.0.9-1 OK
maxima 5.43.2-1 OK
mingw64-i686-binutils 2.34-1 OK
mingw64-i686-freeglut 2.8.1-1 OK
mingw64-i686-gcc-core 9.2.0-2 OK
mingw64-i686-gcc-g++ 9.2.0-2 OK
mingw64-i686-headers 7.0.0-1 OK
mingw64-i686-runtime 7.0.0-1 OK
mingw64-i686-windows-default-manifest 6.4-1 OK
mingw64-i686-winpthreads 7.0.0-1 OK
mingw64-x86_64-binutils 2.34-1 OK
mingw64-x86_64-freeglut 2.8.1-1 OK
mingw64-x86_64-gcc-core 9.2.0-2 OK
mingw64-x86_64-gcc-g++ 9.2.0-2 OK
mingw64-x86_64-headers 7.0.0-1 OK
mingw64-x86_64-runtime 7.0.0-1 OK
mingw64-x86_64-windows-default-manifest 6.4-1 OK
mingw64-x86_64-winpthreads 7.0.0-1 OK
mintty 3.1.4-1 OK
mysql-common 10.3.14-1 OK
ncurses 6.1-1.20190727 OK
nedit 5.6-1 OK
octave 5.2.0-1 OK
octave-control 3.2.0-1 OK
octave-image 2.12.0-1 OK
octave-integration 1.0.8-0.1 OK
octave-io 2.6.0-1 OK
octave-signal 1.4.1-1 OK
octave-specfun 1.1.1-0.1 OK
octave-splines 1.3.3-1 OK
octave-statistics 1.4.2-1 OK
openssh 8.2p1-1 OK
openssl 1.1.1f-1 OK
p11-kit 0.23.20-1 OK
p11-kit-trust 0.23.20-1 OK
patch 2.7.4-1 OK
perl 5.30.2-1 OK
perl-Authen-SASL 2.16-4 OK
perl-Digest-HMAC 1.03-7 OK
perl-Encode-Locale 1.05-3 OK
perl-Error 0.17029-1 OK
perl-File-Listing 6.04-7 OK
perl-HTML-Parser 3.72-3 OK
perl-HTML-Tagset 3.20-7 OK
perl-HTTP-Cookies 6.08-1 OK
perl-HTTP-Daemon 6.06-2 OK
perl-HTTP-Date 6.05-1 OK
perl-HTTP-Message 6.22-1 OK
perl-HTTP-Negotiate 6.01-7 OK
perl-IO-HTML 1.001-4 OK
perl-IO-Socket-SSL 2.068-1 OK
perl-libwww-perl 6.43-1 OK
perl-LWP-MediaTypes 6.04-2 OK
perl-MailTools 2.21-2 OK
perl-MIME-tools 5.509-1 OK
perl-Mozilla-CA 20180117-2 OK
perl-Net-HTTP 6.19-2 OK
perl-Net-SMTP-SSL 1.04-3 OK
perl-Net-SSLeay 1.88-2 OK
perl-Scalar-List-Utils 1.54-1 OK
perl-TermReadKey 2.38-2 OK
perl-Test-Harness 3.42-2 OK
perl-TimeDate 2.32-1 OK
perl-Try-Tiny 0.30-2 OK
perl-Unicode-Normalize 1.26-2 OK
perl-URI 1.76-2 OK
perl-WWW-RobotRules 6.02-7 OK
perl-XML-NamespaceSupport 1.12-3 OK
perl-XML-Parser 2.46-2 OK
perl-XML-SAX 1.02-2 OK
perl-XML-SAX-Base 1.09-3 OK
perl-XML-SAX-Expat 0.51-4 OK
perl-XML-Simple 2.25-2 OK
perl_autorebase 5.30.2-1 OK
perl_base 5.30.2-1 OK
ping 1.9.4-1 OK
pkg-config 1.6.3-1 OK
pkgconf 1.6.3-1 OK
publicsuffix-list-dafsa 20200326-1 OK
python-pip-wheel 19.2.3-1 OK
python-setuptools-wheel 41.2.0-1 OK
python2 2.7.16-1 OK
python27 2.7.16-1 OK
python36 3.6.9-1 OK
python38 3.8.2-1 OK
python38-devel 3.8.2-1 OK
python38-setuptools 41.2.0-1 OK
qt5-devel-tools 5.9.4-1 OK
qt5-doc-tools 5.9.4-1 OK
qt5-linguist-tools 5.9.4-1 OK
R 3.6.3-1 OK
R_autorebase 001001-1 OK
rebase 4.4.4-1 OK
rgb 1.0.6-1 OK
robots 2.3-2 OK
rsync 3.1.2-1 OK
run 1.3.4-2 OK
sed 4.4-1 OK
shared-mime-info 1.8-1 OK
t1lib5 5.1.2-13 OK
tar 1.29-1 OK
tcl 8.6.8-1 OK
tcl-devel 8.6.8-1 OK
tcl-tk 8.6.8-1 OK
tcl-tk-devel 8.6.8-1 OK
terminfo 6.1-1.20190727 OK
terminfo-extra 6.1-1.20190727 OK
texinfo 6.7-1 OK
tzcode 2019c-1 OK
tzdata 2019c-1 OK
unzip 6.0-17 OK
urw-base35-fonts 20170801-5 OK
util-linux 2.33.1-2 OK
vim-minimal 8.2.0486-1 OK
w32api-headers 7.0.0-1 OK
w32api-runtime 7.0.0-1 OK
wget 1.19.1-2 OK
which 2.20-2 OK
windows-default-manifest 6.4-1 OK
xbitmaps 1.1.2-1 OK
xdg-utils 1.1.1-2 OK
xkeyboard-config 2.29-1 OK
xorg-x11-fonts-dpi100 7.5-4 OK
xorg-x11-fonts-dpi75 7.5-4 OK
xz 5.2.4-1 OK
zlib-devel 1.2.11-1 OK
zlib0 1.2.11-1 OK
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Problems with a combination of a mingw program, mintty, and CYGWIN=disable_pcon
2020-05-07 3:38 Problems with a combination of a mingw program, mintty, and CYGWIN=disable_pcon André Bleau
@ 2020-05-07 10:17 ` Takashi Yano
2020-05-07 14:41 ` André Bleau
0 siblings, 1 reply; 3+ messages in thread
From: Takashi Yano @ 2020-05-07 10:17 UTC (permalink / raw)
To: cygwin
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 <takashi.yano@nifty.ne.jp>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Problems with a combination of a mingw program, mintty, and CYGWIN=disable_pcon
2020-05-07 10:17 ` Takashi Yano
@ 2020-05-07 14:41 ` André Bleau
0 siblings, 0 replies; 3+ messages in thread
From: André Bleau @ 2020-05-07 14:41 UTC (permalink / raw)
To: cygwin
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-07 14:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-07 3:38 Problems with a combination of a mingw program, mintty, and CYGWIN=disable_pcon André Bleau
2020-05-07 10:17 ` Takashi Yano
2020-05-07 14:41 ` André Bleau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).