On Mon, Sep 30, 2013 at 02:02:06AM -0400, Curt Zirzow wrote: > On Wed, Sep 11, 2013 at 12:37 PM, Alain Williams <a...@phcomp.co.uk> wrote: > > > Hi, > > > > I am running a PHP script at the command line and piping the output > > through less: > > > > ./myScript | less > > > > > This works as expected for 99% of applications.
Or you could say that it fails for 1% .... > I'm wondering what you mean the commands you type to less.. less is > designed to just show the output in pagination style. Correct. The commands to less are things like: page up/down, search, quit, ... The point about less commands are that they are (generally) single keystrokes, ie the user does not type RETURN after them. To be able to do this less puts the terminal into raw mode. The problem is that PHP puts it back into cooked mode. > > > The sript is not doing anything really clever, just looking at a few files > > and > > printing out directory contents, time stamps, ... > > > > Could you provide an example of that it really is doing. We can only guess > what ./myScript does. It does not matter what the script does as long as it generates more than a page of output, the following will illustrate the problem: for($i = 0; $i < 100; $i++) echo "i=$i\n"; > > ./myScript > /dev/null | (sleep 10;less) > > > > so with this idea you are running a script that expects input, but wants to > ignore output.. how many unix commands that do this? That was a typeo on my part in the original post. It should have been: ./myScript < /dev/null | (sleep 10;less) > However: PHP should not set the terminal to cooked mode in the first place > > > > php allows you to do control things.. if you are so prudent about cooked > mode, then write your application so it isn't so... use stdout, stdin, and > stderr appropriately. I don't think that you have understood the problem. My typeo would not have helped. -- Alain Williams Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php #include <std_disclaimer.h> -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php