I want to be able to use the arrow keys when i pipe output from a php cli script into less. At the moment php cli does something to the tty which can only be fixed when you execute
!stty sane
from within less, which is a right pain!
I found a reference to this problem @ http://www.php.net/manual/en/features.commandline.php#90743 but i can't seem to find an answer :-)
Any help is appreciated, although this problem ranks far below many other problems ;-)
I've been searching for some tweakable to do exactly this. Right now my best workaround is:
php blah.php </dev/null | less
which has the desired effect, but is a pita to have to type. It seems that when the PHP CLI detects stdin is a tty, it puts that tty into linemode.
If you add exec('stty cbreak');
to your cli script, it fixes this. (At least, it does for me, modifying drush.php for this.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With