cvs: php-src /pear/PEAR/Frontend CLI.php
| From: | Stig Bakken | Date: | Tue, 17 Feb 2004 05:49:16 +0000 |
| Subject: | cvs: php-src /pear/PEAR/Frontend CLI.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-104@lists.php.net to get a copy of this message | ||
ssb Tue Feb 17 00:49:16 2004 EDT
Modified files:
/php-src/pear/PEAR/Frontend CLI.php
Log:
* apply bold escape codes only if output is going to a terminal/tty
http://cvs.php.net/diff.php/php-src/pear/PEAR/Frontend/CLI.php?r1=1.40&r2=1.41&ty=u
Index: php-src/pear/PEAR/Frontend/CLI.php
diff -u php-src/pear/PEAR/Frontend/CLI.php:1.40 php-src/pear/PEAR/Frontend/CLI.php:1.41
--- php-src/pear/PEAR/Frontend/CLI.php:1.40 Sun Feb 15 12:43:00 2004
+++ php-src/pear/PEAR/Frontend/CLI.php Tue Feb 17 00:49:16 2004
@@ -16,7 +16,7 @@
| Author: Stig Sæther Bakken <ssb@php.net> |
+----------------------------------------------------------------------+
- $Id: CLI.php,v 1.40 2004/02/15 17:43:00 ssb Exp $
+ $Id: CLI.php,v 1.41 2004/02/17 05:49:16 ssb Exp $
*/
require_once "PEAR.php";
@@ -47,7 +47,9 @@
{
parent::PEAR();
$term = getenv('TERM'); //(cox) $_ENV is empty for me in 4.1.1
- if ($term) {
+ if (function_exists('posix_isatty') && !posix_isatty(1)) {
+ // output is being redirected to a file or through a pipe
+ } elseif ($term) {
// XXX can use ncurses extension here, if available
if (preg_match('/^(xterm|vt220|linux)/', $term)) {
$this->term['bold'] = sprintf("%c%c%c%c", 27, 91, 49, 109);