postgres.git / summary / log / commit / refs

commit    a17ac975e28e2a83caceb8afddc45cae67d724eb
Author:   Andrew Dunstan <andrew@dunslane.net>
Date:     Thu Jun 03 20:08:33 2021 +0000
First released in: 14.0, 9.6.23, 10.18, 11.13, 12.8, 13.4

    In PostgresNode.pm, don't pass SQL to psql on the command line
    
    The Msys shell mangles certain patterns in its command line, so avoid
    handing arbitrary SQL to psql on the command line and instead use
    IPC::Run's redirection facility for stdin. This pattern is already
    mostly whats used, but query_poll_until() was not doing the right thing.
    
    Problem discovered on the buildfarm when a new TAP test failed on msys.


src/test/perl/PostgresNode.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm index f44fbc5b36a..453a1ac16da 100644 --- a/src/test/perl/PostgresNode.pm +++ b/src/test/perl/PostgresNode.pm @@ -1375,14 +1375,15 @@ sub poll_query_until $expected = 't' unless defined($expected); # default value - my $cmd = [ 'psql', '-XAt', '-c', $query, '-d', $self->connstr($dbname) ]; + my $cmd = [ 'psql', '-XAt', '-d', $self->connstr($dbname) ]; my ($stdout, $stderr); my $max_attempts = 180 * 10; my $attempts = 0; while ($attempts < $max_attempts) { - my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr; + my $result = IPC::Run::run $cmd, '<', \$query, + '>', \$stdout, '2>', \$stderr; $stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys'; chomp($stdout); [parent: 20f70f558172]