Branch Coverage

lib/Beekeeper/WorkerPool/Daemon.pm
Criterion Covered Total %
branch 0 146 0.0


line true false branch
48 0 0 if ($extra_options)
50 0 0 if grep {$opt eq $_;} @options_spec
56 0 0 if keys %{$$self{"options"};}
59 0 0 unless &GetOptions(\%options, @options_spec)
71 0 0 unless ($daemon_name)
80 0 0 unless $self->{'config'}{'description'}
93 0 0 if not $cmd or $self->{'options'}{'help'}
95 0 0 if ($cmd eq 'start') { }
0 0 elsif ($cmd eq 'stop') { }
0 0 elsif ($cmd eq 'restart') { }
0 0 elsif ($cmd eq 'reload') { }
0 0 elsif ($cmd eq 'check') { }
0 0 elsif ($cmd eq 'help') { }
127 0 0 if ($self->daemon_is_running)
132 0 0 if $self->{'options'}{'foreground'}
145 0 0 unless ($self->daemon_is_running)
168 0 0 if ($self->daemon_is_running) { }
197 0 0 unless ($self->{'options'}{'foreground'})
200 0 0 if _fork()
203 0 0 unless POSIX::setsid()
207 0 0 if _fork()
217 0 0 if not defined $openmax or $openmax < 0
236 0 0 if (defined(my $pid = fork)) { }
0 0 elsif ($! =~ /No more process/) { }
255 0 0 unless ($logfile)
259 0 0 -d "$dir/$user" ? :
262 0 0 unless $logfile =~ /\.log$/
264 0 0 unless open LOG, ">>", $logfile
266 0 0 unless open STDERR, ">&", \*LOG
267 0 0 unless open STDOUT, ">&", \*LOG
268 0 0 unless open STDIN, "<", "/dev/null"
284 0 0 unless $> == 0
292 0 0 unless (defined $uid)
295 0 0 unless (defined $gid)
298 0 0 unless ($uid > 0)
303 0 0 unless $) = $gid
306 0 0 unless $> = $uid
313 0 0 unless $< == 0
332 0 0 unless ($pidfile)
336 0 0 -d "$dir/$user" ? :
346 0 0 unless $pidfile =~ /\.pid$/
349 0 0 unless sysopen my $fh, $pidfile, 66
350 0 0 unless flock $fh, 6
355 0 0 if ($pid and $pid =~ /^(\d+)/ and $pid != $$)
358 0 0 if ($self->verify_daemon_process($pid))
365 0 0 unless sysseek $fh, 0, 0
366 0 0 unless truncate $fh, 0
367 0 0 unless syswrite $fh, "$$\n", length "$$\n"
375 0 0 unless (-e $pidfile)
381 0 0 unless open my $fh, "<", $pidfile
393 0 0 unless ($pid)
398 0 0 unless ($pid == $$)
404 0 0 unless $pidfile =~ /\.pid$/
405 0 0 unless unlink $pidfile
418 0 0 unless (kill 0, $pid)
423 0 0 unless ($^O =~ /linux|freebsd/i)
431 0 0 unless $pid =~ /^\d+$/
432 0 0 unless my $ps_output = `ps -fp $pid`
435 0 0 unless scalar @ps_lines == 2
443 0 0 $command =~ /$me_regex/ ? :
452 0 0 unless $pid
456 0 0 unless $self->verify_daemon_process($pid)
472 0 0 unless $pid
482 0 0 if (kill 15, $pid)
485 0 0 unless kill 0, $pid
487 0 0 if $elapsed < $send_SIGINT
492 0 0 if (kill 2, $pid)
496 0 0 unless kill 0, $pid
498 0 0 if $elapsed < $send_SIGKILL
503 0 0 if (kill 9, $pid)
507 0 0 unless kill 0, $pid
509 0 0 if $elapsed < $give_up
523 0 0 unless $pid