Bug #65714 [Com]: PHP cli forces the tty to cooked mode

From: Date: Fri, 15 Nov 2013 08:43:35 +0000
Subject: Bug #65714 [Com]: PHP cli forces the tty to cooked mode
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-182767@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65714&edit=1

 ID:                 65714
 Comment by:         remi@php.net
 Reported by:        addw at phcomp dot co dot uk
 Summary:            PHP cli forces the tty to cooked mode
 Status:             Assigned
 Type:               Bug
 Package:            CGI/CLI related
 Operating System:   Linux/Unix
 PHP Version:        5.5.4
 Assigned To:        remi
 Block user comment: N
 Private report:     N

 New Comment:

A simple solution is to not call using_history() which seems not required with libedit (haven't
test with readline).

Without this call, readline_* functions still work as expected.

A explicit call to readline_read_history still required to keep history across runs.


Previous Comments:
------------------------------------------------------------------------
[2013-09-19 15:34:33] addw at phcomp dot co dot uk

Description:
------------
I am running a PHP script at the command line and piping the output through less:

    ./myScript | less

Since less is an interactive program it puts the terminal into 'raw' mode so
that it can read characters one at a time. However, when I do the above I find
that the commands that I type to less are echoed back to me and not acted on
until I type <RETURN>. This is not as it should be.

The sript is not doing anything clever, just generating 100 lines:
    for($i = 0; $i < 100; $i++)
        echo "i=$i\n";

This has been discussed on the Internals mail list, the thread starts here:

http://marc.info/?l=php-internals&m=137915919531612&w=2


Test script:
---------------
I suggest a solution here:

http://marc.info/?l=php-internals&m=137951748702534&w=2





------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=65714&edit=1


Thread (3 messages)

« previous php.bugs (#182767) next »