Skip to content

Commit

Permalink
backport 37c49881 from the EUMM repository
Browse files Browse the repository at this point in the history
  • Loading branch information
tonycoz committed May 14, 2015
1 parent 2ccaf83 commit 3c05f06
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions cpan/ExtUtils-MakeMaker/t/basic.t
Expand Up @@ -33,11 +33,27 @@ use File::Temp qw[tempdir];
my $perl = which_perl();
my $Is_VMS = $^O eq 'VMS';
my $OLD_CP; # crude but...
my $w32worked; # or whether we had to fallback to chcp
if ($^O eq "MSWin32") {
$OLD_CP = $1 if qx(chcp) =~ /(\d+)$/ and $? == 0;
qx(chcp 1252) if defined $OLD_CP;
eval { require Win32; $w32worked = $OLD_CP = Win32::GetConsoleCP() };
$OLD_CP = $1 if !$w32worked and qx(chcp) =~ /(\d+)$/ and $? == 0;
if (defined $OLD_CP) {
if ($w32worked) {
Win32::SetConsoleCP(1252)
} else {
qx(chcp 1252);
}
}
}
END {
if ($^O eq "MSWin32" and defined $OLD_CP) {
if ($w32worked) {
Win32::SetConsoleCP($OLD_CP)
} else {
qx(chcp $OLD_CP);
}
}
}
END { qx(chcp $OLD_CP) if $^O eq "MSWin32" and defined $OLD_CP }

my $tmpdir = tempdir( DIR => 't', CLEANUP => 1 );
chdir $tmpdir;
Expand Down

0 comments on commit 3c05f06

Please sign in to comment.