aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2015-12-08 16:58:05 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2015-12-08 16:58:05 -0500
commit59f10ffa5bc1f39a5ce00806b394feb8f207bb33 (patch)
treeb1ff6ee9756271e1caf21095a4421b8c2a1272d3 /src
parent325b357bc255149c5ace7d77f5c15c941bafef0a (diff)
downloadpostgresql-59f10ffa5bc1f39a5ce00806b394feb8f207bb33.tar.gz
postgresql-59f10ffa5bc1f39a5ce00806b394feb8f207bb33.zip
Avoid odd portability problem in TestLib.pm's slurp_file function.
For unclear reasons, this function doesn't always read the expected data in some old Perl versions. Rewriting it to avoid use of ARGV seems to dodge the problem, and this version is clearer anyway if you ask me. In passing, also improve error message in adjacent append_to_file function.
Diffstat (limited to 'src')
-rw-r--r--src/test/perl/TestLib.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm
index 478f855462f..8eb27df796f 100644
--- a/src/test/perl/TestLib.pm
+++ b/src/test/perl/TestLib.pm
@@ -242,9 +242,12 @@ sub slurp_dir
sub slurp_file
{
+ my ($filename) = @_;
local $/;
- local @ARGV = @_;
- my $contents = <>;
+ open(my $in, '<', $filename)
+ or die "could not read \"$filename\": $!";
+ my $contents = <$in>;
+ close $in;
$contents =~ s/\r//g if $Config{osname} eq 'msys';
return $contents;
}