Skip to content

Commit cdad10a

Browse files
committed
* apply bold escape codes only if output is going to a terminal/tty
1 parent 9551966 commit cdad10a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pear/PEAR/Frontend/CLI.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ function PEAR_Frontend_CLI()
4747
{
4848
parent::PEAR();
4949
$term = getenv('TERM'); //(cox) $_ENV is empty for me in 4.1.1
50-
if ($term) {
50+
if (function_exists('posix_isatty') && !posix_isatty(1)) {
51+
// output is being redirected to a file or through a pipe
52+
} elseif ($term) {
5153
// XXX can use ncurses extension here, if available
5254
if (preg_match('/^(xterm|vt220|linux)/', $term)) {
5355
$this->term['bold'] = sprintf("%c%c%c%c", 27, 91, 49, 109);

0 commit comments

Comments
 (0)