Comments (1)
I'm afraid this is yet another instance of issue 56.
Mintty is based on Cygwin/MSYS pseudo terminal devices (ptys), which are
implemented using Windows pipes. This means that in a MinGW-compiled program
running in mintty, stdout will be a pipe.
The key to the problem is that stdout's default buffering mode depends on the
type of device: unbuffered for a console, buffered for a pipe. This means that
in a console the output will appear immediately, whereas in mintty it will only
appear once the buffer is either full or flushed, as happens at the end of
main().
Hence there are two ways to work around this: call fflush(stdout) whenever
output needs to appear, or switch stdout to unbuffered mode at the start of the
program, like so:
setvbuf(stdout, 0, _IONBF, 0);
Switching it to line buffering, e.g. with setvbuf(stdout, 0, _IOLBF, BUFSIZ),
ought to work too, but apparently with MinGW that has the same effect as
enabling full buffering, because it causes your test to fail in the console too.
The issue appears in other programs that redirect stdio via pipes too, e.g.
Eclipse: https://bugs.eclipse.org/bugs/show_bug.cgi?id=199219.
Programs built with the Cygwin or MSYS compilers are not affected by this.
Original comment by andy.koppe
on 12 Sep 2010 at 4:50
- Changed state: Duplicate
from mintty.
Related Issues (20)
- Support special --position arguments for screen centre and edges HOT 4
- Limited number of fonts HOT 5
- Window placement outside of screen working area HOT 6
- Hang when remote shell opened with "-e" is closed unexpectedly HOT 3
- No response when python script has raw_input command HOT 2
- Support xterm VT220-style function keys HOT 7
- Windows does not handle windows API of Hidden correctly HOT 3
- Window randomly left open HOT 25
- option dialog flicker with win7 desktop compositing off HOT 1
- Crash on selecting extremely long line HOT 11
- support dynamic line rewrapping HOT 2
- Add (hidden?) option to disable ctrl+click link functionality HOT 4
- Build failure due to conflict between UUID.DLL and libuuid HOT 4
- Keep selection on keyboard input HOT 3
- Shift+Fn broken (mc) HOT 2
- Process remains (mc) after windows is closed HOT 1
- Setup.exe causes mintty to freeze HOT 10
- Internationalisation
- Pasting with Ctrl+V
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mintty.