Mercurial > pub > Impl
comparison lib/IMPL/Test/Straps/ShellExecutor.pm @ 407:c6e90e02dd17 ref20150831
renamed Lib->lib
author | cin |
---|---|
date | Fri, 04 Sep 2015 19:40:23 +0300 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
406:f23fcb19d3c1 | 407:c6e90e02dd17 |
---|---|
1 package IMPL::Test::Straps::ShellExecutor; | |
2 use strict; | |
3 use warnings; | |
4 | |
5 use parent qw(IMPL::Object IMPL::Object::Serializable); | |
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; |