Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69153 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73739 invoked from network); 16 Sep 2013 20:17:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Sep 2013 20:17:31 -0000 Authentication-Results: pb1.pair.com header.from=ezyang@MIT.EDU; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ezyang@mit.edu; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain mit.edu designates 18.9.25.14 as permitted sender) X-PHP-List-Original-Sender: ezyang@mit.edu X-Host-Fingerprint: 18.9.25.14 dmz-mailsec-scanner-3.mit.edu Linux 2.6 Received: from [18.9.25.14] ([18.9.25.14:62831] helo=dmz-mailsec-scanner-3.mit.edu) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CA/C2-57385-85767325 for ; Mon, 16 Sep 2013 16:17:31 -0400 X-AuditID: 1209190e-b7f988e0000009a7-6a-523767565a36 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP id 06.89.02471.65767325; Mon, 16 Sep 2013 16:17:26 -0400 (EDT) Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id r8GKHPX1022868; Mon, 16 Sep 2013 16:17:25 -0400 Received: from localhost (generic-california-suburb-number-27.scs.stanford.edu [171.66.3.227]) (authenticated bits=0) (User authenticated as ezyang@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r8GKHMEX026358; Mon, 16 Sep 2013 16:17:24 -0400 Content-Type: text/plain; charset=UTF-8 Cc: PHP internals In-reply-to: <20130914114540.GF3919@phcomp.co.uk> References: <20130914114540.GF3919@phcomp.co.uk> To: Alain Williams Date: Mon, 16 Sep 2013 13:17:21 -0700 Message-ID: <1379362615-sup-7959@javelin> User-Agent: Sup/git Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPIsWRmVeSWpSXmKPExsUixCmqrRuWbh5kcGunsMWVa5OZLQ683cbm wOTxZN0aFo83r56wBTBFcdmkpOZklqUW6dslcGWs2bGVreADT8WiS4/ZGhhPcnYxcnJICJhI vDjwnQ3CFpO4cG89kM3FISSwj1Hi05WP7BDORkaJiSsWQ2WmMEmceNgC5HBwMAuoS6yfJwTS zSygLXHsy0cWEJtTwFDieft8sKnCAtYSv3vus4PYQgIGEmcbdrKC2CICahIL5mwHs9mAxjw6 9hTMZhFQlfh7rJERxOYV0JQ4N+kD2BxRAWGJJ0eamSF2yUs0b53NPIFRYBbCFbOQZBYwMq1i lE3JrdLNTczMKU5N1i1OTszLSy3SNdbLzSzRS00p3cQIDkdJvh2MXw8qHWIU4GBU4uGdIWUe JMSaWFZcmXuIUZKDSUmUlykBKMSXlJ9SmZFYnBFfVJqTWnyIUYKDWUmEN0wXKMebklhZlVqU D5OS5mBREue9bw6UEkhPLEnNTk0tSC2CycpwcChJ8P5MBcoKFqWmp1akZeaUIKSZODhBhvMA DV+aBjK8uCAxtzgzHSJ/ilFRSpxXHSQhAJLIKM2D64Wli1eM4kCvCPPygFTxAFMNXPcroMFM QIPfLzEDGVySiJCSamA08jB5qr/B42/a9fxEYVeD5+63FzyVWxxxcD//ryXSp27l8srf/vx6 IsOJf52rNy6P+2DG9zJ6w7n0+2c+P42Q4K86cUSYL117ft3N18c/v37VrKD0Yfp+vScKWtX/ DjNsiZx6rPHo/n8OjAVZjH7NBjY2a36JmFilVb9Sz9lyzN7zg2PJzDX7lViKMxINtZiLihMB zkosLPICAAA= Subject: Re: [PHP-DEV] PHP CLI setting cooked terminal mode From: ezyang@MIT.EDU ("Edward Z. Yang") I've seen something similar on Debian; it might be a patch that your distro is shipping on top of PHP. Edward Excerpts from Alain Williams's message of Sat Sep 14 04:45:41 -0700 2013: > Hi, > > 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 . 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"; > > 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. > > > I can get it to not do this by connecting stdin to /dev/null: > > ./myScript < /dev/null | less > > another way of getting it to work is (and this shows that it really is PHP that > is messing the tty modes): > > ./myScript < /dev/null | (sleep 10; less) > > However: PHP should not set the terminal to cooked mode in the first place. > > Is there any way in which I can get PHP to not do this ? > > TIA > > I am running PHP 5.3.3 on CentOS 6. > > I posted this to php-general@lists.php.net a few days ago, but did not get a > sensible reply. >