diff options
author | Tony Cook <tony@develop-help.com> | 2015-05-14 13:09:36 +1000 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2015-05-15 11:47:23 +1000 |
commit | 23ff16de19cbd6ba37c687dab842d9493227d642 (patch) | |
tree | ec94400dd71e46f0aa8fb45df9eea6ac104150e2 /cpan | |
parent | 18fe62667c7b9e1cc19201a7075e74e31b6ae16b (diff) | |
download | perl-23ff16de19cbd6ba37c687dab842d9493227d642.tar.gz |
backport 37c49881 from the EUMM repository
Diffstat (limited to 'cpan')
-rw-r--r-- | cpan/ExtUtils-MakeMaker/t/basic.t | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/cpan/ExtUtils-MakeMaker/t/basic.t b/cpan/ExtUtils-MakeMaker/t/basic.t index a0a6f91632..f58211ae00 100644 --- a/cpan/ExtUtils-MakeMaker/t/basic.t +++ b/cpan/ExtUtils-MakeMaker/t/basic.t @@ -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; |