diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2019-07-14 07:27:19 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2019-07-14 07:27:19 +0000 |
commit | 88b2c65bf15734148cde7369d43a263eb77117f1 (patch) | |
tree | 7b3483bdbc6feff3b58f429564323038506f45e9 /usr.sbin/pkg_add/OpenBSD/PackageRepository.pm | |
parent | b51d721eda77cb96fcc0331f9dc190d4666dcfc8 (diff) |
a bunch of changes, all related to error-handling:
- have Handle->register also create a proper END block, so that
individual packages don't have to, and explain the issue
- kill old Unlink/Copy code that migrated to State years ago
- commonalize try{} catch {} for pkg_add/delete and pkg_create, so that
debug works the same way in both.
- switch printing command name to the catch handler, so that exceptions
are simpler to handle
and a few comments for the hairy parts...
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/PackageRepository.pm')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageRepository.pm | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm index e19d2eceaa9..25bd6b9a401 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageRepository.pm,v 1.164 2019/07/10 09:34:38 espie Exp $ +# $OpenBSD: PackageRepository.pm,v 1.165 2019/07/14 07:27:18 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -82,18 +82,12 @@ sub unique return $o; } -my $cleanup = sub { +OpenBSD::Handler->register( + sub { for my $repo (values %$cache) { $repo->cleanup; } -}; -END { - my $a = $?; - &$cleanup; - $? = $a; -} - -OpenBSD::Handler->register($cleanup); + }); sub parse_fullurl { |