Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
451 views
in Technique[技术] by (71.8m points)

mingw - msys not flushing output

I'm using mingw with msys and mintty on windows. I have a problem that msys and mintty are somehow not flushing output until a command is finished. This means I can't really run any interactive programs.

For example, if I have in C:

printf("Test
");

the output won't appear until the program has terminated. However, if I have:

printf("Test
"); fflush(stdout);

then the output appears immediately. If I use msys without mintty or the windows console, then everything works normally.

So my question, what's going on with msys and mintty?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This can be an issue when msys uses the rxvt shell under a number of scenarios. In cases where I see this problem, I ask msys to use the native Windows shell for its console. For example:

C:MinGWmsys1.0msys.bat --no-rxvt

I thought that modern MSYS installations default to using the native shell as MSYS developers seem to prefer it. I have other issues with the native shell that drive me to use the rxvt shell, so I do infrequently run into this issue.

C:MinGWmsys1.0msys.bat --rxvt

I find that the rxvt shell usually works fine except for certain applications that are built as "console" utilities meant to run from a command-line.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...