Skip to content

Commit

Permalink
Merge pull request #63 from wp-cli/windows-check
Browse files Browse the repository at this point in the history
Steal WP-CLI's `is_windows()` check for `Shell`
  • Loading branch information
danielbachhuber committed Aug 10, 2014
2 parents 0f9da9c + efe5b19 commit 4f09ec1
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 4f09ec1

Please sign in to comment.