summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2010-09-19 00:05:27 +0100
committerSteve Hay <steve.m.hay@googlemail.com>2010-09-19 00:06:44 +0100
commit68d2af03d4d9df0563aec7ad1beecd3a21141a5a (patch)
treefdfb324c9db33c97b4c759310c4bb7d42b39a9ca
parentebce6c4037ddaeb7768293042686047859633ac6 (diff)
downloadperl-68d2af03d4d9df0563aec7ad1beecd3a21141a5a.tar.gz
Fix Porting/cmpVERSION.pl to work on Win32
-rwxr-xr-xPorting/cmpVERSION.pl8
1 files changed, 5 insertions, 3 deletions
diff --git a/Porting/cmpVERSION.pl b/Porting/cmpVERSION.pl
index 9ba09e0eb9..dd3d20c462 100755
--- a/Porting/cmpVERSION.pl
+++ b/Porting/cmpVERSION.pl
@@ -39,7 +39,9 @@ die "$0: '$source_dir' does not look like a Perl directory\n"
die "$0: '$source_dir' is a Perl directory but does not look like Git working directory\n"
unless -d catdir($source_dir, ".git");
-my $tag_exists = `git --no-pager tag -l $tag_to_compare 2>/dev/null`;
+my $null = $^O eq 'MSWin32' ? 'nul' : '/dev/null';
+
+my $tag_exists = `git --no-pager tag -l $tag_to_compare 2>$null`;
chomp $tag_exists;
die "$0: '$tag_to_compare' is not a known Git tag\n"
@@ -107,7 +109,7 @@ foreach my $pm_file (@module_diffs) {
sub compare_git_file {
my ($file, $tag) = @_;
- open(my $orig_fh, "-|", "git --no-pager show $tag:$file 2>/dev/null");
+ open(my $orig_fh, "-|", "git --no-pager show $tag:$file 2>$null");
return undef if eof($orig_fh);
my $is_eq = compare($file, $orig_fh) == 0;
close($orig_fh);
@@ -117,7 +119,7 @@ sub compare_git_file {
sub get_file_from_git {
my ($file, $tag) = @_;
local $/ = undef;
- my $file_content = `git --no-pager show $tag:$file 2>/dev/null`;
+ my $file_content = `git --no-pager show $tag:$file 2>$null`;
return $file_content;
}