Hi everyone,
I have a CLI application that produces lots of output to the terminal,
so I like to send the output along to the "less" command. This has
always worked very nicely. Moving to the top or bottom of the output
used to require just hitting the "home" or "end" key, and the up and
down arrows as well as page up and page down worked nicely.
After upgrading to Hardy on Kubuntu, the behavior changed. Now, it seems
to preempt the navigation and instead print ugly codes for each press on
a "navigational key" (one of those mentioned above), such as ^[OF. When
I press "enter", the desired scroll is executed. Scrolling up and down
is one thing, but it's particularly a pain when trying to search through
the output, as it would no longer look up previous search arguments.
I thought at first it's a problem with Konsole, my terminal program, or
with "less" itself. But I've now tried in different terminal programs,
and reading output other than output from PHP, and the ONLY time it
happens is when I pipe output from PHP to "less". I have added a small
test script that exhibits the problem on my system. It may work well the
first time, but when repeating the same command a second time, the
"weird" behavior starts.
It could very well be some kind of problem with "less", but since I can
only reproduce the problem with output from PHP CLI, I thought it's
worth asking here.
Did something about PHP CLI output change lately?
My test script:
<?php
$count = 0;
while ($count < 100){
echo "This is line number $count\n";
$count++;
}
?>
Execute like so:
$ php test.php | less
First time might work without problem, but subsequent times not.
Thanks for any feedback and observations.
Mattias
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php