| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- copyright and license --- |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# file: lib/Dist/Zilla/Role/ProgramRunner.pm |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# Copyright © 2015 Van de Bugger |
|
6
|
|
|
|
|
|
|
# |
|
7
|
|
|
|
|
|
|
# This file is part of perl-Dist-Zilla-PluginBundle-Author-VDB. |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# perl-Dist-Zilla-PluginBundle-Author-VDB is free software: you can redistribute it and/or modify |
|
10
|
|
|
|
|
|
|
# it under the terms of the GNU General Public License as published by the Free Software |
|
11
|
|
|
|
|
|
|
# Foundation, either version 3 of the License, or (at your option) any later version. |
|
12
|
|
|
|
|
|
|
# |
|
13
|
|
|
|
|
|
|
# perl-Dist-Zilla-PluginBundle-Author-VDB is distributed in the hope that it will be useful, but |
|
14
|
|
|
|
|
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
|
15
|
|
|
|
|
|
|
# PARTICULAR PURPOSE. See the GNU General Public License for more details. |
|
16
|
|
|
|
|
|
|
# |
|
17
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License along with |
|
18
|
|
|
|
|
|
|
# perl-Dist-Zilla-PluginBundle-Author-VDB. If not, see <http://www.gnu.org/licenses/>. |
|
19
|
|
|
|
|
|
|
# |
|
20
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- copyright and license --- |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
package Dist::Zilla::Role::Author::VDB::ProgramRunner; |
|
23
|
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
506
|
use Moose::Role; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
7
|
|
|
25
|
1
|
|
|
1
|
|
3843
|
use namespace::autoclean; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6
|
|
|
26
|
1
|
|
|
1
|
|
53
|
use version 0.77; |
|
|
1
|
|
|
|
|
17
|
|
|
|
1
|
|
|
|
|
5
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# ABSTRACT: TODO |
|
29
|
|
|
|
|
|
|
our $VERSION = 'v0.11.2_05'; # TRIAL VERSION |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::ErrorLogger'; |
|
32
|
|
|
|
|
|
|
|
|
33
|
1
|
|
|
1
|
|
76
|
use IPC::Run3 qw{}; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
18
|
|
|
34
|
1
|
|
|
1
|
|
480
|
use String::ShellQuote; |
|
|
1
|
|
|
|
|
713
|
|
|
|
1
|
|
|
|
|
284
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# -------------------------------------------------------------------------------------------------- |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#pod =method run_program |
|
39
|
|
|
|
|
|
|
#pod |
|
40
|
|
|
|
|
|
|
#pod @stdout = @{ $self->run_program( $program, @arguments ) }; |
|
41
|
|
|
|
|
|
|
#pod |
|
42
|
|
|
|
|
|
|
#pod =cut |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub run_program { |
|
45
|
0
|
|
|
0
|
1
|
|
my ( $self, @cmd ) = @_; |
|
46
|
0
|
|
|
|
|
|
my ( @stdout, @stderr ); |
|
47
|
0
|
|
|
|
|
|
my $program = shell_quote( $cmd[ 0 ] ); |
|
48
|
0
|
|
|
|
|
|
IPC::Run3::run3( \@cmd, \undef, \@stdout, \@stderr, { return_if_system_error => 1 } ); |
|
49
|
0
|
0
|
|
|
|
|
if ( $? < 0 ) { |
|
50
|
0
|
|
|
|
|
|
my $err = $!; |
|
51
|
0
|
|
|
|
|
|
$self->abort( [ "Can't run program %s: %s", $program, $err ] ); |
|
52
|
|
|
|
|
|
|
}; |
|
53
|
0
|
|
|
|
|
|
my $signal = $? & 0xFE; |
|
54
|
0
|
|
|
|
|
|
my $status = $? >> 8; |
|
55
|
0
|
|
|
|
|
|
chomp( @stdout ); |
|
56
|
0
|
|
|
|
|
|
chomp( @stderr ); |
|
57
|
0
|
0
|
0
|
|
|
|
my $method = $signal || $status ? 'log_error' : 'log_debug'; |
|
58
|
0
|
|
|
|
|
|
$self->$method( [ "\$ %s", shell_quote( @cmd ) ] ); |
|
59
|
0
|
0
|
|
|
|
|
$self->$method( @stdout ? 'stdout:' : 'stdout is empty' ); |
|
60
|
0
|
|
|
|
|
|
$self->$method( " $_" ) for @stdout; |
|
61
|
0
|
0
|
|
|
|
|
$self->$method( @stderr ? 'stderr:' : 'stderr is empty' ); |
|
62
|
0
|
|
|
|
|
|
$self->$method( " $_" ) for @stderr; |
|
63
|
0
|
0
|
|
|
|
|
if ( $signal ) { |
|
64
|
0
|
|
|
|
|
|
$self->abort( [ "Program %s died with signal %s", $program, $signal ] ); |
|
65
|
|
|
|
|
|
|
}; |
|
66
|
0
|
0
|
|
|
|
|
if ( $status ) { |
|
67
|
0
|
|
|
|
|
|
$self->abort( [ "Program %s exited with status %s", $program, $status ] ); |
|
68
|
|
|
|
|
|
|
}; |
|
69
|
0
|
|
|
|
|
|
return \@stdout; |
|
70
|
|
|
|
|
|
|
}; |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# -------------------------------------------------------------------------------------------------- |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# -------------------------------------------------------------------------------------------------- |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
#pod =head1 COPYRIGHT AND LICENSE |
|
79
|
|
|
|
|
|
|
#pod |
|
80
|
|
|
|
|
|
|
#pod Copyright (C) 2015 Van de Bugger |
|
81
|
|
|
|
|
|
|
#pod |
|
82
|
|
|
|
|
|
|
#pod License GPLv3+: The GNU General Public License version 3 or later |
|
83
|
|
|
|
|
|
|
#pod <http://www.gnu.org/licenses/gpl-3.0.txt>. |
|
84
|
|
|
|
|
|
|
#pod |
|
85
|
|
|
|
|
|
|
#pod This is free software: you are free to change and redistribute it. There is |
|
86
|
|
|
|
|
|
|
#pod NO WARRANTY, to the extent permitted by law. |
|
87
|
|
|
|
|
|
|
#pod |
|
88
|
|
|
|
|
|
|
#pod |
|
89
|
|
|
|
|
|
|
#pod =cut |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# end of file # |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__END__ |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=pod |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=encoding UTF-8 |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 NAME |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Dist::Zilla::Role::Author::VDB::ProgramRunner - TODO |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 VERSION |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Version v0.11.2_05, released on 2016-12-08 00:45 UTC. |
|
106
|
|
|
|
|
|
|
This is a B<trial release>. |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 OBJECT METHODS |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 run_program |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
@stdout = @{ $self->run_program( $program, @arguments ) }; |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 AUTHOR |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Van de Bugger <van.de.bugger@gmail.com> |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Copyright (C) 2015 Van de Bugger |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
License GPLv3+: The GNU General Public License version 3 or later |
|
123
|
|
|
|
|
|
|
<http://www.gnu.org/licenses/gpl-3.0.txt>. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This is free software: you are free to change and redistribute it. There is |
|
126
|
|
|
|
|
|
|
NO WARRANTY, to the extent permitted by law. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |