On a system, where mawk is the default awk instead of gawk (for example, Raspbian Stretch), the following will fail to give any output until all the samples are produced. For default settings, this will cause a delay of 60x10 seconds between CPU usage updates.
On a system, where
mawk
is the defaultawk
instead ofgawk
(for example, Raspbian Stretch), the following will fail to give any output until all the samples are produced. For default settings, this will cause a delay of 60x10 seconds between CPU usage updates.https://github.com/samoshkin/tmux-plugin-sysstat/blob/29e150f403151f2341f3abcb2b2487a5f011dd23/scripts/cpu_collect.sh#L30-L31
I propose two solutions:
awk
with/usr/bin/gawk
everywhere in the code and listgawk
as a dependency.stdbuf
andmawk
can produce streaming output.