Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions lib/cli/Shell.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,21 @@ static public function columns() {
static $columns;

if ( null === $columns ) {
if ( ! self::is_windows() ) {
if (self::is_windows() ) {
$output = array();
exec('mode CON', $output);
foreach ($output as $line) {
if (preg_match('/Columns:( )*([0-9]+)/', $line, $matches)) {
$columns = (int)$matches[2];
break;
}
}
} else {
$columns = (int) exec('/usr/bin/env tput cols');
}

if ( !$columns ) {
$columns = 80; // default width of cmd window on Windows OS, maybe force using MODE CON COLS=XXX?
$columns = 80; // default width of cmd window on Windows OS
}
}

Expand Down