Skip to content

Commit

Permalink
Steal WP-CLI's is_windows() check for Shell
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbachhuber committed Aug 10, 2014
1 parent c3a01e7 commit efe5b19
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/cli/Shell.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static public function columns() {
static $columns;

if ( null === $columns ) {
if (stripos(PHP_OS, 'indows') === false) {
if ( ! self::is_windows() ) {
$columns = (int) exec('/usr/bin/env tput cols');
}

Expand Down Expand Up @@ -71,6 +71,16 @@ static public function isPiped() {
static public function hide($hidden = true) {
system( 'stty ' . ( $hidden? '-echo' : 'echo' ) );
}

/**
* Is this shell in Windows?
*
* @return bool
*/
static private function is_windows() {
return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
}

}

?>

0 comments on commit efe5b19

Please sign in to comment.