You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example, this script doesn't buffer in (g)awk: one is printed right away, then the sleep, then two. Whereas in GoAWK it buffers, so you see one\ntwo together after the sleep:
GoAWK waits because it uses buffered output by default. But the gawk docs indicate gawk buffers too. Is it because gawk doesn't buffer when writing directly to the TTY? But the same behavior seems to happen even when (g)awk output is redirected to a file, so I'm not sure.
The text was updated successfully, but these errors were encountered:
BEGIN {
for (i=0; i<10; i++) {
print i
system("sleep 1")
#fflush()
}
}
I can confirm that gawk, bwk and mawk all output to console at real time (no buffering).
One can "fix" GoAWK by uncommenting the #fflush() line.
The existing buffering behavior can be problematic for some long-running scripts (my https://github.com/xonixx/makesure tool just one example) because it hides the progress of execution.
For example, this script doesn't buffer in (g)awk:
one
is printed right away, then the sleep, thentwo
. Whereas in GoAWK it buffers, so you seeone\ntwo
together after the sleep:GoAWK waits because it uses buffered output by default. But the gawk docs indicate gawk buffers too. Is it because gawk doesn't buffer when writing directly to the TTY? But the same behavior seems to happen even when (g)awk output is redirected to a file, so I'm not sure.
The text was updated successfully, but these errors were encountered: