问题描述
我在Windows上将mingw与msys和mintty一起使用.我有一个问题,即msys和mintty直到命令执行完毕才以某种方式不刷新输出.这意味着我不能真正运行任何交互式程序.
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.
例如,如果我在C
中:
printf("Test\n");
直到程序终止,输出才会出现.但是,如果我有:
the output won't appear until the program has terminated. However, if I have:
printf("Test\n"); fflush(stdout);
然后将立即显示输出.如果我使用没有薄荷味的msys或Windows控制台,则一切正常.
then the output appears immediately. If I use msys without mintty or the windows console, then everything works normally.
所以我的问题是,msys和mintty怎么了?
So my question, what's going on with msys and mintty?
推荐答案
在许多情况下 msys 使用 rxvt shell时,这可能是一个问题.在遇到此问题的情况下,我要求msys将本机Windows Shell用于其控制台.例如:
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:\MinGW\msys\1.0\msys.bat --no-rxvt
我认为现代MSYS安装默认使用本机外壳,因为MSYS开发人员似乎更喜欢它.我的本机外壳还有其他问题,这些问题促使我使用 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:\MinGW\msys\1.0\msys.bat --rxvt
我发现 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.
这篇关于MSYS不刷新输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!