]> granicus.if.org Git - php/commitdiff
* apply bold escape codes only if output is going to a terminal/tty
authorStig Bakken <ssb@php.net>
Tue, 17 Feb 2004 05:49:16 +0000 (05:49 +0000)
committerStig Bakken <ssb@php.net>
Tue, 17 Feb 2004 05:49:16 +0000 (05:49 +0000)
pear/PEAR/Frontend/CLI.php

index 1ecd223c1f8a5393628963f4c3d26ce9a6e6e99a..95067b024fcc6db8caa8f9f127b3e14bc9e7773e 100644 (file)
@@ -47,7 +47,9 @@ class PEAR_Frontend_CLI extends PEAR
     {
         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);