mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 13:11:32 +00:00
Merge ubuntu-12-64-issues
This commit is contained in:
@@ -717,12 +717,17 @@ sub full_output {
|
||||
my ( $code, %args ) = @_;
|
||||
die "I need a code argument" unless $code;
|
||||
|
||||
my (undef, $file) = tempfile();
|
||||
open *output_fh, '>', $file
|
||||
or die "Cannot open file $file: $OS_ERROR";
|
||||
local *STDOUT = *output_fh;
|
||||
local (*STDOUT, *STDERR);
|
||||
require IO::File;
|
||||
|
||||
*STDERR = *STDOUT;
|
||||
my (undef, $file) = tempfile();
|
||||
open *STDOUT, '>', $file
|
||||
or die "Cannot open file $file: $OS_ERROR";
|
||||
*STDOUT->autoflush(1);
|
||||
|
||||
open *STDERR, '>', $file
|
||||
or die "Cannot open file $file: $OS_ERROR";
|
||||
*STDERR->autoflush(1);
|
||||
|
||||
my $status;
|
||||
if (my $pid = fork) {
|
||||
@@ -745,7 +750,7 @@ sub full_output {
|
||||
else {
|
||||
exit $code->();
|
||||
}
|
||||
close *output_fh;
|
||||
close $_ or die "Cannot close $_: $OS_ERROR" for qw(STDOUT STDERR);
|
||||
my $output = do { local $/; open my $fh, "<", $file or die $!; <$fh> };
|
||||
|
||||
return ($output, $status);
|
||||
@@ -772,6 +777,19 @@ sub tables_used {
|
||||
return [ sort keys %tables ];
|
||||
}
|
||||
|
||||
sub load_data_is_disabled {
|
||||
my ($dbh) = @_;
|
||||
my $sql = "LOAD DATA LOCAL INFILE '/dev/null' INTO TABLE "
|
||||
. "`t`.`pt_not_there`";
|
||||
local $@;
|
||||
if (!eval { $dbh->do($sql); 1 } ) {
|
||||
my $e = $@;
|
||||
return 1 if $e =~ qr/\QDBD::mysql::db do failed: The used command is not allowed with this MySQL version [for Statement "LOAD DATA LOCAL INFILE/;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
1;
|
||||
}
|
||||
# ###########################################################################
|
||||
|
||||
@@ -15,8 +15,14 @@
|
||||
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
# Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
# ###########################################################################
|
||||
# ReadKeyMini
|
||||
# ReadKeyMini package
|
||||
# ###########################################################################
|
||||
|
||||
# Package: ReadKeyMini
|
||||
# ReadKeyMini is a wrapper around Term::ReadKey. If that's available,
|
||||
# we use ReadMode and GetTerminalSize from there. Otherwise, we use homebrewn
|
||||
# definitions.
|
||||
|
||||
BEGIN {
|
||||
|
||||
package ReadKeyMini;
|
||||
@@ -29,11 +35,6 @@ package ReadKeyMini;
|
||||
# would solve the issue.
|
||||
BEGIN { $INC{"ReadKeyMini.pm"} ||= 1 }
|
||||
|
||||
# Package: ReadKeyMini
|
||||
# ReadKeyMini is a wrapper around Term::ReadKey. If that's available,
|
||||
# we use ReadMode and GetTerminalSize from there. Otherwise, we use homebrewn
|
||||
# definitions.
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
use English qw(-no_match_vars);
|
||||
@@ -72,7 +73,7 @@ my %modes = (
|
||||
my $flags;
|
||||
unless ( $PerconaTest::DONT_RESTORE_STDIN ) {
|
||||
$flags = fcntl(STDIN, F_GETFL, 0)
|
||||
or die "can't fcntl F_GETFL: $!";
|
||||
or warn "can't fcntl F_GETFL: $!";
|
||||
}
|
||||
my $term = POSIX::Termios->new();
|
||||
$term->getattr($fd_stdin);
|
||||
@@ -106,7 +107,7 @@ my %modes = (
|
||||
$term->setattr( $fd_stdin, TCSANOW );
|
||||
unless ( $PerconaTest::DONT_RESTORE_STDIN ) {
|
||||
fcntl(STDIN, F_SETFL, $flags)
|
||||
or die "can't fcntl F_SETFL: $!";
|
||||
or warn "can't fcntl F_SETFL: $!";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,16 +169,18 @@ sub _GetTerminalSize {
|
||||
}
|
||||
}
|
||||
|
||||
eval {
|
||||
if ( $rows = `tput lines` ) {
|
||||
chomp($rows);
|
||||
chomp($cols = `tput cols`);
|
||||
}
|
||||
elsif ( my $stty = `stty -a` ) {
|
||||
($rows, $cols) = $stty =~ /([0-9]+) rows; ([0-9]+) columns;/;
|
||||
}
|
||||
};
|
||||
PTDEBUG && _d($EVAL_ERROR);
|
||||
if ( $rows = `tput lines 2>/dev/null` ) {
|
||||
chomp($rows);
|
||||
chomp($cols = `tput cols`);
|
||||
}
|
||||
elsif ( my $stty = `stty -a 2>/dev/null` ) {
|
||||
($rows, $cols) = $stty =~ /([0-9]+) rows; ([0-9]+) columns;/;
|
||||
}
|
||||
else {
|
||||
($cols, $rows) = @ENV{qw( COLUMNS LINES )};
|
||||
$cols ||= 80;
|
||||
$rows ||= 24;
|
||||
}
|
||||
|
||||
return ( $cols, $rows );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user