Commit 6e5260d9 by Alexander Makarov

Implemented Console::getScreenSize for Windows

parent 113751ea
...@@ -568,7 +568,7 @@ class Console ...@@ -568,7 +568,7 @@ class Console
*/ */
public static function isRunningOnWindows() public static function isRunningOnWindows()
{ {
return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; return DIRECTORY_SEPARATOR == '\\';
} }
/** /**
...@@ -584,8 +584,11 @@ class Console ...@@ -584,8 +584,11 @@ class Console
} }
if (static::isRunningOnWindows()) { if (static::isRunningOnWindows()) {
// TODO implement for windows $output = array();
return $size = false; exec('mode con', $output);
if(isset($output) && strpos($output[1], 'CON')!==false) {
return $size = array((int)preg_replace('~[^0-9]~', '', $output[3]), (int)preg_replace('~[^0-9]~', '', $output[4]));
}
} else { } else {
// try stty if available // try stty if available
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment