Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I try something like

php -i | less

Less is not responding to hotkeys, but prints them like pressing "q" results in statusline

:q

PageDown

:^[[6~

Pressing ENTER like "executes" the keycode and less perfoems the action.

Piping trivial small stuff work however...

OS: Fedora 14

share|improve this question
up vote 2 down vote accepted

php -i is doing something weird with stdin. Try this:

php -i </dev/null | less
share|improve this answer
    
Great suggestion, thanks. – SnakeSurgeon Mar 15 '11 at 6:32
    
Actually, it's less that does the "something weird". It changes to non-canonical mode input processing. Of course php may well be doing something as well, but this is simply a specific case of the more general don't have two programs simultaneously interacting with the terminal that employ different terminal input modes and expect things to work. – JdeBP Mar 17 '11 at 20:29
    
@JdeBP: less may very well be doing something weird, but this is from strace php -i without less: ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0 – Dennis Williamson Mar 17 '11 at 21:00
    
Setting canonical mode input processing (icanon) is not "something weird". Canonical mode is the norm. Hence its name. – JdeBP Mar 18 '11 at 13:44
1  
@JdeBP: Well, I don't know what's hidden behind the ... and perhaps the clue lies elsewhere. But why is php -i opening stdin at all? It does this same odd behavior with more (which is not a symlink or alias on my system), but, interestingly, not pg or (inconsistently) most. PHP also does this with php -r 'for ($i = 1; $i <= 100; $i++) { print "$i\n"; }' | less. AWK, Perl, Python, etc., don't exhibit this weirdness. Conclusion: PHP is broken. – Dennis Williamson Mar 18 '11 at 14:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .