$mpd = Net::Async::MPD->new(%conn);
+ $mpd->loop->add(
+ IO::Async::Signal->new(
+ name => 'TERM',
+ on_receipt => sub {
+ $log->debug("SIGTERM received. Stopping loop");
+ $mpd->loop->stop('quit');
+ },
+ )
+ );
+
+ $mpd->loop->add(
+ IO::Async::Signal->new(
+ name => 'INT',
+ on_receipt => sub {
+ $log->debug("SIGINT received. Stopping loop");
+ $mpd->loop->stop('quit');
+ },
+ )
+ );
+
$mpd->loop->add(
IO::Async::Signal->new(
name => 'HUP',
exec( "$0", '--config', $self->cfg_file, '--skip-db-update' );
}
+
+ if ( 'quit' eq $result ) {
+ $log->trace("quitting because of 'quit' loop result");
+ $self->stop;
+ exit 0;
+ }
}
}
}