Re: PHP CLI setting cooked terminal mode
| From: | Julien Pauli | Date: | Wed, 18 Sep 2013 14:33:50 +0000 |
| Subject: | Re: PHP CLI setting cooked terminal mode | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-69197@lists.php.net to get a copy of this message | ||
On Wed, Sep 18, 2013 at 4:20 PM, Alain Williams <addw@phcomp.co.uk> wrote:
> On Wed, Sep 18, 2013 at 04:13:39PM +0200, Remi Collet wrote:
> > Le 18/09/2013 16:04, Alain Williams a écrit :
> >
> > > What is needed is for this to NOT be called if the standard output is
> not
> > > connected to a tty.
> >
> > From your previous message:
> >
> > > ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon
> echo ...}) = 0
> > > ioctl(0, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost isig icanon
> echo ...}) = 0
> >
> > Which is standard input, not standard output
>
> Yes - a typeo, sorry.
>
> > I can get it to not do this by connecting stdin to /dev/null:
> >
> > ./myScript < /dev/null | less
> >
> > qed
> >
> > > Should I raise this as a bug ?
> >
> > So, I don't think there is any bug there.
>
> The redirection of stdin to /dev/null is NOT a solution. You don't need to
> do
> this with scripts written in other languages (eg shell, perl). It makes
> using
> the script for the end user more difficult and strangely different from
> scripts
> written in other languages.
>
>
One could use ltrace -l to trace library calls.
On my laptop (Debian) :
ltrace -l /usr/lib/x86_64-linux-gnu/libedit.so.2 php -a
using_history(1, 38, 0x250000000f, 712, 0x1087900) = 0
Interactive shell
tilde_expand(0xd48ef1, 0x24a0ae8, 0, 17, 149464) =
0x24c61c0
read_history(0x24c61c0, 0x7f0a6eb9f986, 0x8e0f5f, 0x7f0a6eb9f986, 0) = 0
readline("php > "php >
Julien.Pauli