pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/lintpkgsrc/files lintpkgsrc: add error handli...
details: https://anonhg.NetBSD.org/pkgsrc/rev/eed68b5b6852
branches: trunk
changeset: 383324:eed68b5b6852
user: rillig <rillig%pkgsrc.org@localhost>
date: Wed Aug 17 18:28:33 2022 +0000
description:
lintpkgsrc: add error handling for files and subprocesses
diffstat:
pkgtools/lintpkgsrc/files/lintpkgsrc.pl | 21 ++++++++++-----------
1 files changed, 10 insertions(+), 11 deletions(-)
diffs (74 lines):
diff -r 4318d03b3592 -r eed68b5b6852 pkgtools/lintpkgsrc/files/lintpkgsrc.pl
--- a/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Wed Aug 17 18:25:26 2022 +0000
+++ b/pkgtools/lintpkgsrc/files/lintpkgsrc.pl Wed Aug 17 18:28:33 2022 +0000
@@ -1,5 +1,5 @@
#!@PERL5@
-# $NetBSD: lintpkgsrc.pl,v 1.113 2022/08/17 18:25:26 rillig Exp $
+# $NetBSD: lintpkgsrc.pl,v 1.114 2022/08/17 18:28:33 rillig Exp $
# Written by David Brownlee <abs%netbsd.org@localhost>.
#
@@ -555,7 +555,7 @@
open(FILE, $file) or return undef;
chomp(@lines = <FILE>);
- close(FILE);
+ close(FILE) or die;
push @incdirs, '.';
push @incdirs, dirname($file);
@@ -785,10 +785,9 @@
}
sub list_installed_packages() {
- open(PKG_INFO, "$conf_pkg_info -e '*' |")
- or fail("Unable to run $conf_pkg_info: $!");
+ open(PKG_INFO, "$conf_pkg_info -e '*' |") or die;
chomp(my @pkgs = <PKG_INFO>);
- close(PKG_INFO);
+ close(PKG_INFO) or die;
map { $_ = canonicalize_pkgname($_) } @pkgs;
}
@@ -973,11 +972,11 @@
if (!$pid) {
warn "$file: Unable to run make: $!";
} else {
- close(WTR);
+ close(WTR) or die;
my @errors = <ERR>;
- close(ERR);
+ close(ERR) or die;
my ($makepkgname) = <RDR>;
- close(RDR);
+ close(RDR) or die;
wait;
chomp @errors;
if (@errors) { warn "\n$file: @errors\n"; }
@@ -1228,7 +1227,7 @@
my $pid2 = fork();
defined $pid2 || fail 'fork';
if ($pid2) {
- close($in);
+ close($in) or die;
} else {
print $in "@{$sumfiles{$sum}}";
exit 0;
@@ -1241,7 +1240,7 @@
}
}
}
- close($out);
+ close($out) or die;
waitpid($pid, 0) || fail "xargs digest $sum";
waitpid($pid2, 0) || fail 'pipe write to xargs';
}
@@ -1563,7 +1562,7 @@
while (<PKGINFO>) {
print " $1" if /^(.*?)-\d/;
}
- close(PKGINFO);
+ close(PKGINFO) or die;
print "\n";
}
Home |
Main Index |
Thread Index |
Old Index