Skip to content

Commit c5f9c03

Browse files
Merge pull request #113 from wp-cli/issue_112
Suppress tput stderr. Use COLUMNS env var 1st if available.
2 parents 2d2b582 + 105bc96 commit c5f9c03

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/cli/Shell.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ static public function columns() {
4949
}
5050
}
5151
} else {
52-
if ( getenv( 'TERM' ) ) {
53-
$columns = (int) exec( '/usr/bin/env tput cols' );
52+
if ( ! ( $columns = (int) getenv( 'COLUMNS' ) ) ) {
53+
if ( getenv( 'TERM' ) ) {
54+
$columns = (int) exec( '/usr/bin/env tput cols 2>/dev/null' );
55+
}
5456
}
5557
}
5658
}

0 commit comments

Comments
 (0)