line |
true |
false |
branch |
23
|
0 |
47 |
@_ == 1 ? : |
27
|
47 |
0 |
unless defined $opts->{'interval'} |
40
|
0 |
47 |
unless $ports or $paths |
42
|
41 |
6 |
if not ref $ports and defined $ports |
44
|
6 |
41 |
if not ref $paths and defined $paths |
47
|
0 |
47 |
unless $opts->{'exec'} and ref $opts->{'exec'} eq 'ARRAY' |
51
|
4 |
43 |
if defined $opts->{'envdir'} |
53
|
12 |
35 |
if defined $opts->{'enable_auto_restart'} |
55
|
12 |
35 |
if defined $opts->{'kill_old_delay'} |
57
|
6 |
41 |
if defined $opts->{'auto_restart_interval'} |
61
|
0 |
47 |
if ($opts->{'log_file'}) |
62
|
0 |
0 |
if ($opts->{'log_file'} =~ /^\s*\|\s*/s) { } |
64
|
0 |
0 |
unless open $logfh, '|-', $cmd |
68
|
0 |
0 |
unless open $logfh, '>>', $opts->{'log_file'} |
92
|
37 |
4 |
if ($hostport =~ /^\s*(\d+)(?:\s*=(\d+))?\s*$/) { } |
|
4 |
0 |
elsif ($hostport =~ /^\s*(?:\[\s*|)([^\]]*)\s*(?:\]\s*|):\s*(\d+)(?:\s*=(\d+))?\s*$/) { } |
101
|
2 |
2 |
if ($host =~ /:/) { } |
106
|
0 |
2 |
unless my $addr = Socket::inet_pton(10, $host) |
111
|
0 |
2 |
if ($@) |
125
|
0 |
2 |
unless my $addr = gethostbyname $host |
132
|
0 |
41 |
unless socket my $sock, $domain, 1, 0 |
136
|
0 |
41 |
unless bind $sock, $sa |
139
|
0 |
41 |
unless listen $sock, $opts->{'backlog'} |
140
|
0 |
41 |
unless fcntl $sock, 2, my $flags = '' |
142
|
2 |
39 |
if (defined $fd) { } |
143
|
0 |
2 |
unless POSIX::dup2($sock->fileno, $fd) |
160
|
0 |
6 |
if (-S $path) |
162
|
0 |
0 |
unless unlink $path |
169
|
0 |
6 |
unless my $sock = 'IO::Socket::UNIX'->new('Listen', $opts->{'backlog'}, 'Local', $path) |
172
|
0 |
6 |
unless fcntl $sock, 2, my $flags = '' |
191
|
0 |
40 |
unless open my $tmpfh, '>', $tmpfn |
198
|
33 |
7 |
$current_worker ? : |
204
|
0 |
40 |
unless rename $tmpfn, $opts->{'status_file'} |
206
|
22 |
25 |
$opts->{'status_file'} ? : |
209
|
0 |
47 |
if ($logfh) |
212
|
0 |
0 |
unless open STDOUT, '>&=', $logfh |
214
|
0 |
0 |
unless open STDERR, '>&=', $logfh |
221
|
8 |
39 |
if ($opts->{'daemonize'}) |
223
|
0 |
8 |
unless defined $pid |
225
|
2 |
6 |
if ($pid != 0) |
232
|
0 |
6 |
unless defined $pid |
234
|
2 |
4 |
if ($pid != 0) |
239
|
4 |
0 |
unless (grep /=0$/, @sockenv) |
241
|
0 |
4 |
unless open STDIN, '<', '/dev/null' |
248
|
39 |
4 |
unless $opts->{'pid_file'} |
250
|
0 |
4 |
unless open my $fh, '>', $opts->{'pid_file'} |
251
|
0 |
4 |
unless flock $fh, 2 |
258
|
0 |
2 |
unless unlink $opts->{'pid_file'} |
270
|
0 |
76 |
unless defined $pid |
272
|
28 |
48 |
if ($pid == 0) |
275
|
2 |
26 |
if (defined $opts->{'dir'}) |
276
|
0 |
2 |
unless chdir $opts->{'dir'} |
284
|
38 |
10 |
if (grep {$_ ne 'HUP';} @signals_received or waitpid($pid, 1) <= 0) |
300
|
31 |
39 |
if ($block and $ENV{'ENABLE_AUTO_RESTART'}) { } |
313
|
15 |
0 |
$sig eq 'TERM' ? : |
321
|
15 |
0 |
if (my(@r) = _wait3(1)) |
341
|
31 |
39 |
if $ENV{'ENABLE_AUTO_RESTART'} |
343
|
12 |
58 |
if (@r) |
345
|
2 |
10 |
if ($died_worker == $current_worker) { } |
358
|
17 |
43 |
if ($sig eq 'HUP') { } |
|
28 |
15 |
elsif ($sig eq 'ALRM') { } |
368
|
29 |
8 |
if (not $restart and $ENV{'ENABLE_AUTO_RESTART'}) |
371
|
4 |
25 |
if ($elapsed_since_restart >= $auto_restart_interval and not %old_workers) { } |
|
0 |
25 |
elsif ($elapsed_since_restart >= $auto_restart_interval * 2) { } |
380
|
21 |
33 |
if ($restart) |
384
|
10 |
0 |
if (%old_workers) { } |
389
|
0 |
6 |
$ENV{'ENABLE_AUTO_RESTART'} ? : |
|
4 |
6 |
defined $ENV{'KILL_OLD_DELAY'} ? : |
390
|
4 |
6 |
if ($kill_old_delay != 0) |
406
|
0 |
0 |
@_ == 1 ? : |
410
|
0 |
0 |
unless $opts->{'pid_file'} and $opts->{'status_file'} |
415
|
0 |
0 |
unless open my $fh, '<', $opts->{'pid_file'} |
424
|
0 |
0 |
unless open my $fh, '<', $opts->{'status_file'} |
427
|
0 |
0 |
if ($line =~ /^(\d+):/) |
436
|
0 |
0 |
unless my(@gens) = &$get_generations() |
442
|
0 |
0 |
unless kill 'HUP', $pid |
448
|
0 |
0 |
if scalar @gens == 1 and $gens[0] == $wait_for |
454
|
0 |
2 |
@_ == 1 ? : |
458
|
0 |
2 |
unless $opts->{'pid_file'} |
462
|
0 |
2 |
unless open my $fh, '+<', $opts->{'pid_file'} |
472
|
0 |
2 |
unless kill 'TERM', $pid |
476
|
0 |
2 |
unless flock $fh, 2 |
483
|
0 |
0 |
unless $ENV{'SERVER_STARTER_PORT'} |
492
|
61 |
9 |
unless defined $dn and -d $dn |
494
|
0 |
9 |
unless opendir $d, $dn |
497
|
18 |
5 |
if $n =~ /^\./ |
498
|
0 |
5 |
unless open my $fh, '<', "$dn/$n" |
500
|
5 |
0 |
if defined $v |
513
|
59 |
3 |
if $sighandler_should_die |
521
|
86 |
3 |
if ($block) { } |
526
|
0 |
86 |
if $sighandler_got_sig |
530
|
58 |
0 |
if ($pid == -1 and $@) |
536
|
28 |
61 |
$pid > 0 ? : |