|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
  
 
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #  | 
| 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # (c) Jan Gehring   | 
| 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #  | 
| 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package Rex::Interface::Executor::Default;  | 
| 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
7
 | 
55
 | 
 
 | 
 
 | 
  
55
  
 | 
 
 | 
821
 | 
 use v5.12.5;  | 
| 
 
 | 
55
 | 
 
 | 
 
 | 
 
 | 
 
 | 
221
 | 
    | 
| 
8
 | 
55
 | 
 
 | 
 
 | 
  
55
  
 | 
 
 | 
331
 | 
 use warnings;  | 
| 
 
 | 
55
 | 
 
 | 
 
 | 
 
 | 
 
 | 
142
 | 
    | 
| 
 
 | 
55
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2766
 | 
    | 
| 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our $VERSION = '1.14.2.2'; # TRIAL VERSION  | 
| 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
12
 | 
55
 | 
 
 | 
 
 | 
  
55
  
 | 
 
 | 
685
 | 
 use Rex::Hook;  | 
| 
 
 | 
55
 | 
 
 | 
 
 | 
 
 | 
 
 | 
143
 | 
    | 
| 
 
 | 
55
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3618
 | 
    | 
| 
13
 | 
55
 | 
 
 | 
 
 | 
  
55
  
 | 
 
 | 
377
 | 
 use Rex::Logger;  | 
| 
 
 | 
55
 | 
 
 | 
 
 | 
 
 | 
 
 | 
164
 | 
    | 
| 
 
 | 
55
 | 
 
 | 
 
 | 
 
 | 
 
 | 
429
 | 
    | 
| 
14
 | 
55
 | 
 
 | 
 
 | 
  
55
  
 | 
 
 | 
1433
 | 
 use Data::Dumper;  | 
| 
 
 | 
55
 | 
 
 | 
 
 | 
 
 | 
 
 | 
188
 | 
    | 
| 
 
 | 
55
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2688
 | 
    | 
| 
15
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
16
 | 
55
 | 
 
 | 
 
 | 
  
55
  
 | 
 
 | 
717
 | 
 use Rex::Interface::Executor::Base;  | 
| 
 
 | 
55
 | 
 
 | 
 
 | 
 
 | 
 
 | 
141
 | 
    | 
| 
 
 | 
55
 | 
 
 | 
 
 | 
 
 | 
 
 | 
769
 | 
    | 
| 
17
 | 
55
 | 
 
 | 
 
 | 
  
55
  
 | 
 
 | 
2199
 | 
 use base qw(Rex::Interface::Executor::Base);  | 
| 
 
 | 
55
 | 
 
 | 
 
 | 
 
 | 
 
 | 
165
 | 
    | 
| 
 
 | 
55
 | 
 
 | 
 
 | 
 
 | 
 
 | 
25948
 | 
    | 
| 
18
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
19
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 require Rex::Args;  | 
| 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub new {  | 
| 
22
 | 
213
 | 
 
 | 
 
 | 
  
213
  
 | 
  
0
  
 | 
522
 | 
   my $that  = shift;  | 
| 
23
 | 
213
 | 
 
 | 
  
 33
  
 | 
 
 | 
 
 | 
1022
 | 
   my $proto = ref($that) || $that;  | 
| 
24
 | 
213
 | 
 
 | 
 
 | 
 
 | 
 
 | 
503
 | 
   my $self  = {@_};  | 
| 
25
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
26
 | 
213
 | 
 
 | 
 
 | 
 
 | 
 
 | 
493
 | 
   bless( $self, $proto );  | 
| 
27
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
28
 | 
213
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1499
 | 
   return $self;  | 
| 
29
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
30
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
31
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub exec {  | 
| 
32
 | 
54
 | 
 
 | 
 
 | 
  
54
  
 | 
  
0
  
 | 
497
 | 
   my ( $self, $opts, $args ) = @_;  | 
| 
33
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
34
 | 
54
 | 
 
 | 
 
 | 
 
 | 
 
 | 
277
 | 
   my $task = $self->{task};  | 
| 
35
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
36
 | 
54
 | 
 
 | 
 
 | 
 
 | 
 
 | 
723
 | 
   Rex::Logger::debug( "Executing " . $task->name );  | 
| 
37
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
38
 | 
54
 | 
 
 | 
 
 | 
 
 | 
 
 | 
188
 | 
   my $wantarray = wantarray;  | 
| 
39
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
40
 | 
54
 | 
 
 | 
 
 | 
 
 | 
 
 | 
214
 | 
   my @ret;  | 
| 
41
 | 
54
 | 
 
 | 
 
 | 
 
 | 
 
 | 
194
 | 
   eval {  | 
| 
42
 | 
54
 | 
 
 | 
 
 | 
 
 | 
 
 | 
534
 | 
     my $code = $task->code;  | 
| 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
44
 | 
54
 | 
 
 | 
 
 | 
 
 | 
 
 | 
371
 | 
     Rex::Hook::run_hook( task => "before_execute", $task->name, @_ );  | 
| 
45
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
46
 | 
54
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
346
 | 
     if ($wantarray) {  | 
| 
47
 | 
1
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
11
 | 
       if ( ref $opts eq "ARRAY" ) {  | 
| 
48
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3
 | 
         @ret = $code->( @{$opts} );  | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
    | 
| 
49
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       }  | 
| 
50
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       else {  | 
| 
51
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         @ret = $code->( $opts, $args );  | 
| 
52
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       }  | 
| 
53
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
54
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     else {  | 
| 
55
 | 
53
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
528
 | 
       if ( ref $opts eq "ARRAY" ) {  | 
| 
56
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
31
 | 
         $ret[0] = $code->( @{$opts} );  | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
133
 | 
    | 
| 
57
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       }  | 
| 
58
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       else {  | 
| 
59
 | 
40
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3548
 | 
         $ret[0] = $code->( $opts, $args );  | 
| 
60
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       }  | 
| 
61
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
62
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
63
 | 
47
 | 
 
 | 
 
 | 
 
 | 
 
 | 
22957
 | 
     Rex::Hook::run_hook( task => "after_execute", $task->name, @_ );  | 
| 
64
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   };  | 
| 
65
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
66
 | 
54
 | 
 
 | 
 
 | 
 
 | 
 
 | 
381
 | 
   my $error = $@;  | 
| 
67
 | 
54
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2058
 | 
   my %opts  = Rex::Args->getopts;  | 
| 
68
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
69
 | 
54
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
436
 | 
   if ($error) {  | 
| 
70
 | 
7
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
61
 | 
     if ( exists $opts{o} ) {  | 
| 
71
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
       Rex::Output->get->add( $task->name, error => 1, msg => $error );  | 
| 
72
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
73
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     else {  | 
| 
74
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
106
 | 
       Rex::Logger::info( "Error executing task:", "error" );  | 
| 
75
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
82
 | 
       Rex::Logger::info( "$error",                "error" );  | 
| 
76
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
143
 | 
       die($error);  | 
| 
77
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
78
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   }  | 
| 
79
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   else {  | 
| 
80
 | 
47
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
309
 | 
     if ( exists $opts{o} ) {  | 
| 
81
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
       Rex::Output->get->add( $task->name );  | 
| 
82
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
83
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   }  | 
| 
84
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
85
 | 
47
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
355
 | 
   if ($wantarray) {  | 
| 
86
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6
 | 
     return @ret;  | 
| 
87
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   }  | 
| 
88
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   else {  | 
| 
89
 | 
46
 | 
 
 | 
 
 | 
 
 | 
 
 | 
462
 | 
     return $ret[0];  | 
| 
90
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   }  | 
| 
91
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
92
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
93
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  |