mirror of
https://github.com/postgres/postgres.git
synced 2025-07-24 14:22:24 +03:00
Pre-beta mechanical code beautification.
Run pgindent, pgperltidy, and reformat-dat-files. This set of diffs is a bit larger than typical. We've updated to pg_bsd_indent 2.1.2, which properly indents variable declarations that have multi-line initialization expressions (the continuation lines are now indented one tab stop). We've also updated to perltidy version 20230309 and changed some of its settings, which reduces its desire to add whitespace to lines to make assignments etc. line up. Going forward, that should make for fewer random-seeming changes to existing code. Discussion: https://postgr.es/m/20230428092545.qfb3y5wcu4cm75ur@alvherre.pgsql
This commit is contained in:
@ -82,20 +82,28 @@ sub new
|
||||
{
|
||||
my $class = shift;
|
||||
my ($interactive, $psql_params) = @_;
|
||||
my $psql = {'stdin' => '', 'stdout' => '', 'stderr' => '', 'query_timer_restart' => undef};
|
||||
my $psql = {
|
||||
'stdin' => '',
|
||||
'stdout' => '',
|
||||
'stderr' => '',
|
||||
'query_timer_restart' => undef
|
||||
};
|
||||
my $run;
|
||||
|
||||
# This constructor should only be called from PostgreSQL::Test::Cluster
|
||||
my ($package, $file, $line) = caller;
|
||||
die "Forbidden caller of constructor: package: $package, file: $file:$line"
|
||||
my ($package, $file, $line) = caller;
|
||||
die
|
||||
"Forbidden caller of constructor: package: $package, file: $file:$line"
|
||||
unless $package->isa('PostgreSQL::Test::Cluster');
|
||||
|
||||
$psql->{timeout} = IPC::Run::timeout($PostgreSQL::Test::Utils::timeout_default);
|
||||
$psql->{timeout} =
|
||||
IPC::Run::timeout($PostgreSQL::Test::Utils::timeout_default);
|
||||
|
||||
if ($interactive)
|
||||
{
|
||||
$run = IPC::Run::start $psql_params,
|
||||
'<pty<', \$psql->{stdin}, '>pty>', \$psql->{stdout}, '2>', \$psql->{stderr},
|
||||
'<pty<', \$psql->{stdin}, '>pty>', \$psql->{stdout}, '2>',
|
||||
\$psql->{stderr},
|
||||
$psql->{timeout};
|
||||
}
|
||||
else
|
||||
@ -126,8 +134,9 @@ sub _wait_connect
|
||||
# errors anyway, but that might be added later.)
|
||||
my $banner = "background_psql: ready";
|
||||
$self->{stdin} .= "\\echo $banner\n";
|
||||
$self->{run}->pump() until $self->{stdout} =~ /$banner/ || $self->{timeout}->is_expired;
|
||||
$self->{stdout} = ''; # clear out banner
|
||||
$self->{run}->pump()
|
||||
until $self->{stdout} =~ /$banner/ || $self->{timeout}->is_expired;
|
||||
$self->{stdout} = ''; # clear out banner
|
||||
|
||||
die "psql startup timed out" if $self->{timeout}->is_expired;
|
||||
}
|
||||
@ -173,10 +182,10 @@ sub reconnect_and_clear
|
||||
|
||||
# restart
|
||||
$self->{run}->run();
|
||||
$self->{stdin} = '';
|
||||
$self->{stdin} = '';
|
||||
$self->{stdout} = '';
|
||||
|
||||
$self->_wait_connect()
|
||||
$self->_wait_connect();
|
||||
}
|
||||
|
||||
=pod
|
||||
@ -219,7 +228,7 @@ sub query
|
||||
|
||||
$ret = $self->{stderr} eq "" ? 0 : 1;
|
||||
|
||||
return wantarray ? ( $output, $ret ) : $output;
|
||||
return wantarray ? ($output, $ret) : $output;
|
||||
}
|
||||
|
||||
=pod
|
||||
|
Reference in New Issue
Block a user