Skip to content

Commit 3754890

Browse files
Merge pull request #314 from webstech/next
Fix #311 Windows doesn't have '\dev\null'
2 parents ce7c497 + 1c510fb commit 3754890

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/DiffHighlight.pm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ use 5.008;
44
use warnings FATAL => 'all';
55
use strict;
66
use Encode;
7+
use File::Spec; # For devnull
8+
9+
my $NULL = File::Spec->devnull(); # get correct value for unix/win
710

811
# Highlight by reversing foreground and background. You could do
912
# other things like bold or underline if you prefer.
@@ -88,7 +91,7 @@ sub highlight_stdin {
8891
# fallback, which means we will work even if git can't be run.
8992
sub color_config {
9093
my ($key, $default) = @_;
91-
my $s = `git config --get-color $key 2>/dev/null`;
94+
my $s = `git config --get-color $key 2>$NULL`;
9295
return length($s) ? $s : $default;
9396
}
9497

0 commit comments

Comments
 (0)