]> Sergey Matveev's repositories - public-inbox.git/commitdiff
daemon: lazy load Cwd only for --daemonize users
authorEric Wong <e@80x24.org>
Sun, 20 Dec 2020 06:30:13 +0000 (06:30 +0000)
committerEric Wong <e@80x24.org>
Sun, 20 Dec 2020 20:39:12 +0000 (20:39 +0000)
systemd users won't need it polluting the namespace; though
other things are still likely to load it.

lib/PublicInbox/Daemon.pm

index a2171535c9ae2a3656c498318f6fa534ecd48691..d1a42fc348a4ae4fbd8d4cd32809e7d0a06d1d75 100644 (file)
@@ -11,7 +11,6 @@ use IO::Socket;
 use POSIX qw(WNOHANG :signal_h);
 use Socket qw(IPPROTO_TCP SOL_SOCKET);
 sub SO_ACCEPTFILTER () { 0x1000 }
-use Cwd qw/abs_path/;
 STDOUT->autoflush(1);
 STDERR->autoflush(1);
 use PublicInbox::DS qw(now);
@@ -202,10 +201,11 @@ sub check_absolute ($$) {
 
 sub daemonize () {
        if ($daemonize) {
+               require Cwd;
                foreach my $i (0..$#ARGV) {
                        my $arg = $ARGV[$i];
                        next unless -e $arg;
-                       $ARGV[$i] = abs_path($arg);
+                       $ARGV[$i] = Cwd::abs_path($arg);
                }
                check_absolute('stdout', $stdout);
                check_absolute('stderr', $stderr);