mingwmsysmintty

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\n");

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

printf("Test\n"); 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?


Solution

  • 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
    

    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
    

    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.