Permalink
Browse files

Fix up recent commits for Windows.

  • Loading branch information...
1 parent f650a35 commit 209973b3d2d093483c79ec6f51627d5fbcde081a @pjcj committed Jul 15, 2012
Showing with 17 additions and 16 deletions.
  1. +3 −2 lib/Devel/Cover.pm
  2. +14 −14 lib/Devel/Cover/Test.pm
View
@@ -109,9 +109,10 @@ BEGIN
{
local %ENV = %ENV;
/perl/i and delete $ENV{$_} for keys %ENV;
- my $inc = `$^X -MData::Dumper -e 'print Dumper \\\@INC'`;
+ my $cmd = "$^X -MData::Dumper -e " . '"print Dumper \@INC"';
dolmen
dolmen Jul 16, 2012 Contributor

This will not work on Win32: the '' will not be expanded by the shell (because cmd.exe doesn't expand anything).

dolmen
dolmen Jul 16, 2012 Contributor

I'm wrong. I was thinking you were escaping the '@' with '' while in fact you want to pass a reference to @Inc to Dumper. So the code is ok.

my $VAR1;
- eval $inc;
+ # print STDERR "Running [$cmd]\n";
+ eval `$cmd`;
@Inc = @$VAR1;
};
if ($@)
View
@@ -53,6 +53,14 @@ sub new
$self->get_params
}
+sub shell_quote
+{
+ my ($item) = @_;
+
+ $^O eq "MSWin32" ? (/ / and $_ = qq("$_")) : s/ /\\ /g for $item;
+ $item
+};
+
sub get_params
{
my $self = shift;
@@ -83,7 +91,8 @@ sub get_params
}
$self->{cover_parameters} = join(" ", map "-coverage $_",
split " ", $self->{criteria})
- . " -report text '" . $self->{cover_db} . "'";
+ . " -report text "
+ . shell_quote $self->{cover_db};
$self->{cover_parameters} .= " -uncoverable_file "
. "@{$self->{uncoverable_file}}"
if @{$self->{uncoverable_file}};
@@ -101,14 +110,6 @@ sub get_params
$self
}
-sub shell_quote
-{
- my ($item) = @_;
-
- $^O eq "MSWin32" ? (/ / and $_ = qq("$_")) : s/ /\\ /g for $item;
- $item
-};
-
sub perl
{
my $self = shift;
@@ -126,11 +127,10 @@ sub test_command
my $c = $self->perl;
unless ($self->{no_coverage})
{
- $c .= " '-MDevel::Cover=" .
- join(",",
- "-db", $self->{cover_db},
- split " ", $self->{test_parameters}) .
- "'";
+ $c .= " "
+ . shell_quote "-MDevel::Cover=" .
+ join(",", "-db", $self->{cover_db},
+ split " ", $self->{test_parameters});
}
$c .= " " . shell_quote $self->test_file;
$c .= " " . $self->test_file_parameters;

0 comments on commit 209973b

Please sign in to comment.