From 9f5a583694396f84056b9d92255bba0197b52bc8 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 10 Jan 2020 09:14:19 +0000 Subject: spawn (and thus popen_rd) die on failure Most spawn and popen_rd callers die on failure to spawn, anyways, and some are missing checks entirely. This saves us a bunch of verbose error-checking code in callers. This also makes popen_rd more consistent, since it already dies on pipe creation failures. --- lib/PublicInbox/Import.pm | 2 -- 1 file changed, 2 deletions(-) (limited to 'lib/PublicInbox/Import.pm') diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm index 572e9bb9..6ac43d37 100644 --- a/lib/PublicInbox/Import.pm +++ b/lib/PublicInbox/Import.pm @@ -68,7 +68,6 @@ sub gfi_start { --quiet --done --date-format=raw)); my $rdr = { 0 => $out_r, 1 => $in_w }; my $pid = spawn(\@cmd, undef, $rdr); - die "spawn fast-import failed: $!" unless defined $pid; $out_w->autoflush(1); $self->{in} = $in_r; $self->{out} = $out_w; @@ -430,7 +429,6 @@ sub add { sub run_die ($;$$) { my ($cmd, $env, $rdr) = @_; my $pid = spawn($cmd, $env, $rdr); - defined $pid or die "spawning ".join(' ', @$cmd)." failed: $!"; waitpid($pid, 0) == $pid or die join(' ', @$cmd) .' did not finish'; $? == 0 or die join(' ', @$cmd) . " failed: $?\n"; } -- cgit v1.2.3-24-ge0c7