Don't ask to ask, just ask | |
PerlMonks |
Re^3: Printing to STDOUT buffered when invoking Perl within a bash-script using teeby haukex (Archbishop) |
on Dec 05, 2016 at 15:24 UTC ( [id://1177229]=note: print w/replies, xml ) | Need Help?? |
Hi TJCooper, the Perl script is NOT buffered when ran as a standalone script A described in the article I linked to, Perl decides whether STDOUT should be line or block buffered depending on whether it is connected to a terminal or not. For example, you should notice a difference in the behavior of the following: the middle one delays its output until the end due to the buffering.
I have tried this In the following bash script, if I remove the $|=1;, it displays the undesired behavior you describe; with the autoflush turned on it shows the expected "live" view.
So if you've tried $|=1; and are still getting the undesired behavior, perhaps you could show a Short, Self Contained, Correct (Compatible) Example for us to reproduce the problem. ... after your update to the node while I was typing my reply: I had tried using that magic-variable and it did not work...but now it does. Please see How do I change/delete my post?, especially "It is uncool to update a node in a way that renders replies confusing or meaningless". Regards, Update: Referenced article.
In Section
Seekers of Perl Wisdom
|
|