From bc5f141e8e4e4df3813dd123cf5a76355e65be17 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 5 Mar 2016 22:42:12 +0000 Subject: [PATCH] daemon: document optional Net::Server dependency Non-socket activation users will want to install Net::Server for daemonization, pid file writing, and user/group switching. --- INSTALL | 5 +++-- lib/PublicInbox/Daemon.pm | 6 +++++- t/httpd-unix.t | 6 +++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/INSTALL b/INSTALL index 54c344c7..013e8d15 100644 --- a/INSTALL +++ b/INSTALL @@ -47,10 +47,11 @@ Optional modules: - DBI[3] libdbi-perl - DBD::SQLite[3] libdbd-sqlite3-perl - Danga::Socket[4] libdanga-socket-perl + - Net::Server[4] libnet-server-perl [1] - Only required for serving/generating Atom and HTML pages. -[3] - Optional for HTML web interface and NNTP server -[4] - Optional for NNTP server +[3] - Optional for HTML web interface and HTTP/NNTP servers +[4] - Optional for HTTP and NNTP servers Copyright --------- diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm index 8a0af8de..51562624 100644 --- a/lib/PublicInbox/Daemon.pm +++ b/lib/PublicInbox/Daemon.pm @@ -94,7 +94,11 @@ sub daemonize () { return unless (defined $pid_file || defined $group || defined $user || $daemonize); - require Net::Server::Daemonize; + eval { require Net::Server::Daemonize }; + if ($@) { + die +"Net::Server required for --pid-file, --group, --user, and --daemonize\n$@\n"; + } Net::Server::Daemonize::check_pid_file($pid_file) if defined $pid_file; $uid = Net::Server::Daemonize::get_uid($user) if defined $user; diff --git a/t/httpd-unix.t b/t/httpd-unix.t index 580d14d2..b3368491 100644 --- a/t/httpd-unix.t +++ b/t/httpd-unix.t @@ -81,7 +81,11 @@ check_sock($unix); is($?, 0, 'existing httpd exited successfully'); ok(-S $unix, 'unix socket still exists'); } -{ + +SKIP: { + eval 'require Net::Server::Daemonize'; + skip('Net::Server missing for pid-file/daemonization test', 10) if $@; + # wait for daemonization $spawn_httpd->("-l$unix", '-D', '-P', "$tmpdir/pid"); my $kpid = $pid; -- 2.44.0