trjconv doesn't display stdout properly during conversion - Redmine #1772
Archive from user: James Barnett
Example:
I run a 100 ns simulation saving a frame every 1 ps, so I have 100,000 frames. I convert the file to a new trajectory with 50,000 frames (so every 2ps):
gmx trjconv -f prd.xtc -dt 2 -o out.xtc
During the conversion this is displayed for example (the number obviously updates) with lots of flickering throughout the entire conversion process (until the end where it is displayed properly):
-> frame 490 time 980.000 -> frame 450 time 900.000
Other times I run it, it shows up properly throughout the entire run:
Reading frame 1000 time 1000.000 -> frame 500 time 1000.000
(from redmine: issue id 1772, created on 2015-07-10 by gmxdefault, closed on 2016-05-10)
- Changesets:
- Revision 85d59d17 by Erik Lindahl on 2016-05-10T13:58:55Z:
Flush streams when not writing newline character
Some of our routines use the carriage return without a newline
to keep writing the status e.g. on stderr.
For some operating systems this seems to lead to the output
being cached in the buffers, so this change adds an explicit
fflush() for these print stamements.
Fixed #1772.
Change-Id: I3ad9c4f0e962d8a0b2f8d2341af69f0e3d01a477