about summary refs log tree commit homepage
path: root/lib/PublicInbox/Daemon.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-12-15 11:47:17 +0000
committerEric Wong <e@80x24.org>2020-12-16 04:40:03 +0000
commit4aafd44087292ac5ab254f02c3358267c685374b (patch)
treecc3f804f6f80d1e894b26c5084970a0a1eaf93c8 /lib/PublicInbox/Daemon.pm
parentab11caeb8ae114087636748df4c956d0e625b237 (diff)
downloadpublic-inbox-4aafd44087292ac5ab254f02c3358267c685374b.tar.gz
The defined-or `//' operator in 5.10 allows us to golf down
our code slightly.
Diffstat (limited to 'lib/PublicInbox/Daemon.pm')
-rw-r--r--lib/PublicInbox/Daemon.pm6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index fdedaee7..a2171535 100644
--- a/lib/PublicInbox/Daemon.pm
+++ b/lib/PublicInbox/Daemon.pm
@@ -237,8 +237,7 @@ EOF
         };
 
         if ($daemonize) {
-                my $pid = fork;
-                die "could not fork: $!\n" unless defined $pid;
+                my $pid = fork // die "fork: $!";
                 exit if $pid;
 
                 open(STDIN, '+<', '/dev/null') or
@@ -246,8 +245,7 @@ EOF
                 open STDOUT, '>&STDIN' or die "redirect stdout failed: $!\n";
                 open STDERR, '>&STDIN' or die "redirect stderr failed: $!\n";
                 POSIX::setsid();
-                $pid = fork;
-                die "could not fork: $!\n" unless defined $pid;
+                $pid = fork // die "fork: $!";
                 exit if $pid;
         }
         return unless defined $pid_file;