-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
system("") does not flush output #41
Comments
actually, I don't see in the text where gawk says this is "required",
and then
|
let me quote the whole paragraph here:
i'm reading [0] http://pubs.opengroup.org/onlinepubs/009695399/utilities/awk.html |
mawk does flush all output when doing system. |
What may be confusing the OP is that mawk buffers its input. Or in other words, it won't start processing its input until a buffer full has been read. It's the only utility implementation that I know that does that (and is annoying at times). In:
You do see the output in the right order (mawk does flush its output), but you have to wait the 2 seconds to get it. That's where it differs from other awk implementaions. |
interesting. i didn't reply yet because i analyzed the source and mawk does indeed flush all fds (including stdout) when calling system(), but still behaves as if it does not, which forces me to pass -W interactive to make mawk behave as expected. |
|
As a consideration it might be reasonable to make |
according to the GNU awk manual, awk is required to flush its output when a system() call is executed, and so system("") serves as a neat and portable trick to force a flush of stdout.
http://gnu.huihoo.org/gawk-3.0.3/html_node/gawk_126.html
see "Controlling Output Buffering with system"
The text was updated successfully, but these errors were encountered: