line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Eixo::Zone::Ctl; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
2514
|
use strict; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
131
|
|
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
3739
|
use IPC::Open3; |
|
5
|
|
|
|
|
36568
|
|
|
5
|
|
|
|
|
1375
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
my $LOG = undef; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
0
|
843
|
sub setLOG { $LOG = 1 } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub __runSys{ |
12
|
0
|
|
|
0
|
|
|
my ($self, $opc, @cmd) = @_; |
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
|
my ($w, $r, $e); |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
my $echo; |
17
|
|
|
|
|
|
|
|
18
|
0
|
0
|
|
|
|
|
print join(" ", @cmd, "\n") if($LOG); |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my $pid = open3($w, $r, $e, @cmd); |
21
|
|
|
|
|
|
|
|
22
|
0
|
0
|
|
|
|
|
if($opc->{wait}){ |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
waitpid($pid, 0); |
25
|
|
|
|
|
|
|
|
26
|
0
|
0
|
|
|
|
|
if($? >> 8){ |
27
|
0
|
|
|
|
|
|
die("Error [" . join(' ' , @cmd) . '] ' . join("", <$r>, <$e>)); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
if($opc->{echo}){ |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
$echo = join('', <$r>); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
return $echo; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub runSysWait{ |
41
|
0
|
|
|
0
|
0
|
|
my ($self, @cmd) = @_; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
$self->__runSys({wait => 1}, @cmd); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub runSysWaitEcho{ |
47
|
0
|
|
|
0
|
0
|
|
my ($self, @cmd) = @_; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
$self->__runSys({ |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
wait => 1, |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
echo=>1 |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
}, @cmd); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |