note 80550 deleted from function.system by cmb
| From: | cmb@php.net | Date: | Sun, 08 Dec 2019 11:50:26 +0000 |
| Subject: | note 80550 deleted from function.system by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213492@lists.php.net to get a copy of this message | ||
Note Submitter: Dennis
----
If you are writing CLI scripts in PHP and call external programs which produce some kind of progress
bar you should really use passthru() for the output of the external program to go to the terminal
immediately.
Such progress bar are usually done by outputing the string with "\r" at the end, and
contain no "\n". system() and friends look for "\n" before flushing the buffer.
As a result, you see nothing during the lengthy operation and suddenly you get the 100% reading,
because all output was buffered and quickly replayed into the terminal when the final "\n"
has been seen.