aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2021-06-03 16:08:33 -0400
committerAndrew Dunstan <andrew@dunslane.net>2021-06-03 17:29:52 -0400
commitb5bd1351fd7b967259cd505199422c28ed2ccd98 (patch)
treeee203e94d1d6878ae1b5aa47b64e806027ada1d3
parentdbc9dbba56529a915effa6078f9303343aedf3f1 (diff)
downloadpostgresql-b5bd1351fd7b967259cd505199422c28ed2ccd98.tar.gz
postgresql-b5bd1351fd7b967259cd505199422c28ed2ccd98.zip
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.
-rw-r--r--src/test/perl/PostgresNode.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm
index 92221d2cc68..72a1fe36779 100644
--- a/src/test/perl/PostgresNode.pm
+++ b/src/test/perl/PostgresNode.pm
@@ -1495,14 +1495,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);