Re: PHP CLI setting cooked terminal mode

From: Date: Mon, 16 Sep 2013 20:01:37 +0000
Subject: Re: PHP CLI setting cooked terminal mode
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On 14.09.13 13:45, Alain Williams wrote:
>     ./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.
> 
> If I run the script under strace I see:
> 
>     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
> 
> What is happening is that PHP is putting the terminal into cooked mode.

Are you sure it is PHP that's doing this?  There are basically no calls
to ioctl() (or tcsetattr() for that matter) outside of ext/ at all.

- Martin



Thread (12 messages)

« previous php.internals (#69152) next »