mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 13:11:32 +00:00
Merge eval-tput.
This commit is contained in:
@@ -157,7 +157,8 @@ sub _GetTerminalSize {
|
|||||||
die "My::Term::ReadKey doesn't implement GetTerminalSize with arguments";
|
die "My::Term::ReadKey doesn't implement GetTerminalSize with arguments";
|
||||||
}
|
}
|
||||||
|
|
||||||
my ( $rows, $cols );
|
my $cols = $ENV{COLUMNS} || 80;
|
||||||
|
my $rows = $ENV{LINES} || 24;
|
||||||
|
|
||||||
if ( open( TTY, "+<", "/dev/tty" ) ) { # Got a tty
|
if ( open( TTY, "+<", "/dev/tty" ) ) { # Got a tty
|
||||||
my $winsize = '';
|
my $winsize = '';
|
||||||
@@ -167,6 +168,7 @@ sub _GetTerminalSize {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eval {
|
||||||
if ( $rows = `tput lines` ) {
|
if ( $rows = `tput lines` ) {
|
||||||
chomp($rows);
|
chomp($rows);
|
||||||
chomp($cols = `tput cols`);
|
chomp($cols = `tput cols`);
|
||||||
@@ -174,11 +176,8 @@ sub _GetTerminalSize {
|
|||||||
elsif ( my $stty = `stty -a` ) {
|
elsif ( my $stty = `stty -a` ) {
|
||||||
($rows, $cols) = $stty =~ /([0-9]+) rows; ([0-9]+) columns;/;
|
($rows, $cols) = $stty =~ /([0-9]+) rows; ([0-9]+) columns;/;
|
||||||
}
|
}
|
||||||
else {
|
};
|
||||||
($cols, $rows) = @ENV{qw( COLUMNS LINES )};
|
PTDEBUG && _d($EVAL_ERROR);
|
||||||
$cols ||= 80;
|
|
||||||
$rows ||= 24;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ( $cols, $rows );
|
return ( $cols, $rows );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user