libxmp / xmp-cli

Command-line mod player using libxmp
GNU General Public License v2.0
75 stars 22 forks source link

Add setvbuf(_IONBF) to fix terminal output for MSYS2 #16

Closed AliceLR closed 3 years ago

AliceLR commented 3 years ago

Terminal output when using xmp in MSYS2 is fairly unresponsive—typically it takes between 1-2 patterns into the song before any song information is printed, and the current order/row/time lags behind. The problem appears to be that xmp assumes stderr is unbuffered but, for whatever reason, MSYS2 has a fully buffered stderr. Adding an fflush() to report() in main.c makes the terminal output as responsive as it is in Linux. I don't think this is required for any of the other fprintf usages since those are always followed by report() or exit().

sezero commented 3 years ago

How about using setvbuf() on stderr for windows builds, instead?

AliceLR commented 3 years ago

That works too.