Skip to content
This repository was archived by the owner on Jun 18, 2022. It is now read-only.

Commit 4f09ec1

Browse files
Merge pull request wp-cli#63 from wp-cli/windows-check
Steal WP-CLI's `is_windows()` check for `Shell`
2 parents 0f9da9c + efe5b19 commit 4f09ec1

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

lib/cli/Shell.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static public function columns() {
2828
static $columns;
2929

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

@@ -71,6 +71,16 @@ static public function isPiped() {
7171
static public function hide($hidden = true) {
7272
system( 'stty ' . ( $hidden? '-echo' : 'echo' ) );
7373
}
74+
75+
/**
76+
* Is this shell in Windows?
77+
*
78+
* @return bool
79+
*/
80+
static private function is_windows() {
81+
return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
82+
}
83+
7484
}
7585

7686
?>

0 commit comments

Comments
 (0)