OSDN Git Service

introduce is_windows() helper
authorscribu <mail@scribu.net>
Wed, 25 Dec 2013 17:13:50 +0000 (19:13 +0200)
committerscribu <mail@scribu.net>
Wed, 25 Dec 2013 17:13:50 +0000 (19:13 +0200)
php/commands/help.php
php/utils.php

index d722a92..46cf470 100644 (file)
@@ -76,7 +76,7 @@ class Help_Command extends WP_CLI_Command {
        }
 
        private static function pass_through_pager( $out ) {
-               if ( strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ) {
+               if ( Utils\is_windows() ) {
                        // no paging for Windows cmd.exe; sorry
                        echo $out;
                        return 0;
index 1972c25..a281bd1 100644 (file)
@@ -375,3 +375,10 @@ function parse_url( $url ) {
        return $url_parts;
 }
 
+/**
+ * Check if we're running in a Windows environment (cmd.exe).
+ */
+function is_windows() {
+       return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
+}
+