}
else
{
- $stdout =~ s/\r//g if $Config{osname} eq 'msys';
+ $stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
is($stdout, $expected_stdout, "$test_name: query result matches");
}
}
my $cmd = [ 'psql', '-At', '-c', "$query", '-d', "$connstr" ];
my $result = run $cmd, '>', \$stdout, '2>', \$stderr;
+ $stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
chomp($stdout);
- $stdout =~ s/\r//g if $Config{osname} eq 'msys';
if ($stdout eq "t")
{
return 1;
# The query result didn't change in 90 seconds. Give up. Print the
# output from the last attempt, hopefully that's useful for debugging.
+ $stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
chomp($stderr);
- $stderr =~ s/\r//g if $Config{osname} eq 'msys';
diag qq(poll_query_until timed out executing this query:
$query
expecting this output:
print "\n#### End standard error\n";
}
- $stdout =~ s/\r//g if $TestLib::windows_os;
return $stdout;
}
}
};
+ # Note: on Windows, IPC::Run seems to convert \r\n to \n in program output
+ # if we're using native Perl, but not if we're using MSys Perl. So do it
+ # by hand in the latter case, here and elsewhere.
+
if (defined $$stdout)
{
+ $$stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
chomp $$stdout;
- $$stdout =~ s/\r//g if $TestLib::windows_os;
}
if (defined $$stderr)
{
+ $$stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
chomp $$stderr;
- $$stderr =~ s/\r//g if $TestLib::windows_os;
}
# See http://perldoc.perl.org/perlvar.html#%24CHILD_ERROR
[ 'psql', '-XAt', '-c', $query, '-d', $self->connstr($dbname) ];
my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr;
+ $stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
chomp($stdout);
- $stdout =~ s/\r//g if $TestLib::windows_os;
if ($stdout eq "t")
{
return 1;
# The query result didn't change in 180 seconds. Give up. Print the
# output from the last attempt, hopefully that's useful for debugging.
+ $stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
chomp($stderr);
- $stderr =~ s/\r//g if $TestLib::windows_os;
diag qq(poll_query_until timed out executing this query:
$query
expecting this output:
my ($stdout, $stderr);
print("# Running SQL command: $sql\n");
run [ 'psql', '-X', '-A', '-t', '-q', '-d', $dbname, '-f', '-' ], '<', \$sql, '>', \$stdout, '2>', \$stderr or die;
+ $stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
chomp $stdout;
- $stdout =~ s/\r//g if $Config{osname} eq 'msys';
return $stdout;
}
or die "could not read \"$filename\": $!";
my $contents = <$in>;
close $in;
- $contents =~ s/\r//g if $Config{osname} eq 'msys';
+ $contents =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
return $contents;
}