Re: [PHP] PHP-CLI and the "less" command (kubuntu)

2008-07-02 Thread Mattias Thorslund

Stut wrote:

On 2 Jul 2008, at 02:58, Mattias Thorslund wrote:

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?


This has nothing to do with PHP. The keystrokes are processed by less 
so your problem lies there or more likely with the terminal emulation 
you're using. Please try a more relevant list.


-Stut


I agree the keystrokes are processed by less. This is probably more a 
problem with "less". Yes I will ask on other lists as well.


I thought it was irrelevant to PHP until I tried to provoke the same 
behavior by reading large files or other console input. Nope, only PHP 
output does it, so I figured someone here might have encountered this 
behavior too.


Mattias

Maybe you didn't


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP-CLI and the "less" command (kubuntu)

2008-07-02 Thread Stut

On 2 Jul 2008, at 02:58, Mattias Thorslund wrote:

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?


This has nothing to do with PHP. The keystrokes are processed by less  
so your problem lies there or more likely with the terminal emulation  
you're using. Please try a more relevant list.


-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP-CLI and the "less" command (kubuntu)

2008-07-01 Thread Mattias Thorslund

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:



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