better error report when I botch some test writing
authorespie <espie@openbsd.org>
Wed, 20 Apr 2022 09:07:42 +0000 (09:07 +0000)
committerespie <espie@openbsd.org>
Wed, 20 Apr 2022 09:07:42 +0000 (09:07 +0000)
regress/usr.sbin/pkg_add/populate

index ab0393b..2ba237a 100644 (file)
@@ -57,7 +57,8 @@ package main;
 
 my $state = myState->new;
 $state->handle_options;
-my $plist = OpenBSD::PackingList->fromfile($state->opt('f'),
+my $filename = $state->opt('f');
+my $plist = OpenBSD::PackingList->fromfile($filename,
     sub {
        my ($fh, $cont) = @_;
        while (<$fh>) {
@@ -65,5 +66,9 @@ my $plist = OpenBSD::PackingList->fromfile($state->opt('f'),
        }
     });
 
+if (!defined $plist) {
+       $state->fatal("Error reading packing-list #1", $filename);
+}
+
 my $localbase = $state->opt('L') // OpenBSD::Paths->localbase;
 $plist->populate($state->opt('B').$localbase);