Skip to content

Commit 11e9caf

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 3590680 commit 11e9caf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/test/perl/PostgresNode.pm

+3-2
Original file line numberDiff line numberDiff line change
@@ -2127,15 +2127,16 @@ sub poll_query_until
21272127

21282128
my $cmd = [
21292129
$self->installed_command('psql'),
2130-
'-XAt', '-c', $query, '-d', $self->connstr($dbname)
2130+
'-XAt', '-d', $self->connstr($dbname)
21312131
];
21322132
my ($stdout, $stderr);
21332133
my $max_attempts = 180 * 10;
21342134
my $attempts = 0;
21352135

21362136
while ($attempts < $max_attempts)
21372137
{
2138-
my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr;
2138+
my $result = IPC::Run::run $cmd, '<', \$query,
2139+
'>', \$stdout, '2>', \$stderr;
21392140

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

0 commit comments

Comments
 (0)