Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0c92ed1

Browse files
committed
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.
1 parent 4ceaa76 commit 0c92ed1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/test/perl/PostgresNode.pm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,14 +1544,15 @@ sub poll_query_until
15441544

15451545
$expected = 't' unless defined($expected); # default value
15461546

1547-
my $cmd = [ 'psql', '-XAt', '-c', $query, '-d', $self->connstr($dbname) ];
1547+
my $cmd = [ 'psql', '-XAt', '-d', $self->connstr($dbname) ];
15481548
my ($stdout, $stderr);
15491549
my $max_attempts = 180 * 10;
15501550
my $attempts = 0;
15511551

15521552
while ($attempts < $max_attempts)
15531553
{
1554-
my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr;
1554+
my $result = IPC::Run::run $cmd, '<', \$query,
1555+
'>', \$stdout, '2>', \$stderr;
15551556

15561557
$stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
15571558
chomp($stdout);

0 commit comments

Comments
 (0)