49
+ − 1 package IMPL::Test::Straps::ShellExecutor;
+ − 2 use strict;
+ − 3 use warnings;
+ − 4
166
+ − 5 use parent qw(IMPL::Object IMPL::Object::Serializable);
49
+ − 6
+ − 7 if ($^O =~ /win32/i) {
+ − 8 require Win32::Console;
+ − 9 }
+ − 10
+ − 11 sub Execute {
+ − 12 my ($this,$file) = @_;
+ − 13
+ − 14 my $h;
+ − 15
+ − 16 if ($^O =~ /win32/i) {
+ − 17 Win32::Console::OutputCP(65001);
+ − 18 unless ( open $h,'-|',$file ) {
+ − 19 return undef;
+ − 20 }
+ − 21 binmode $h,':encoding(utf-8)';
+ − 22 } else {
+ − 23 unless ( open $h,'-|',$file ) {
+ − 24 return undef;
+ − 25 }
+ − 26 }
+ − 27
+ − 28 return $h;
+ − 29 }
+ − 30
+ − 31
+ − 32 1;