Use new Daemon API.

This commit is contained in:
Daniel Nichter
2013-08-03 12:29:08 -07:00
parent e192a90b77
commit f9b005b083
2 changed files with 8 additions and 13 deletions

View File

@@ -14039,17 +14039,12 @@ sub main {
# ########################################################################
# Daemonize now that everything is setup and ready to work.
# ########################################################################
my $daemon;
if ( $o->get('daemonize') ) {
$daemon = new Daemon(o=>$o);
$daemon->daemonize();
PTDEBUG && _d('I am a daemon now');
}
elsif ( $o->get('pid') ) {
# We're not daemoninzing, it just handles PID stuff.
$daemon = new Daemon(o=>$o);
$daemon->make_PID_file();
}
my $daemon = Daemon->new(
daemonize => $o->get('daemonize'),
pid_file => $o->get('pid'),
log_file => $o->get('log'),
);
$daemon->run();
# ########################################################################
# Do the version-check

View File

@@ -32,8 +32,8 @@ my $pid_file = '/tmp/pt-query-digest.test.pid';
$output = `$trunk/bin/pt-query-digest $trunk/commont/t/samples/slow002.txt --pid $pid_file 2>&1`;
like(
$output,
qr{PID file $pid_file already exists},
'Dies if PID file already exists (--pid without --daemonize) (issue 391)'
qr{PID file $pid_file exists},
'Dies if PID file exists (--pid without --daemonize) (issue 391)'
);
`rm $pid_file >/dev/null 2>&1`;