summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/pkg_add/OpenBSD/AddDelete.pm26
1 files changed, 17 insertions, 9 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm
index 37a27344af8..567fd9d4912 100644
--- a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm
+++ b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: AddDelete.pm,v 1.32 2010/06/30 10:51:04 espie Exp $
+# $OpenBSD: AddDelete.pm,v 1.33 2010/07/01 19:15:59 espie Exp $
#
# Copyright (c) 2007-2010 Marc Espie <espie@openbsd.org>
#
@@ -56,7 +56,8 @@ sub do_the_main_work
sub framework
{
my ($self, $state) = @_;
- try {
+
+ my $do = sub {
lock_db($state->{not}) unless $state->defines('nolock');
$state->check_root;
$self->process_parameters($state);
@@ -74,14 +75,21 @@ sub framework
}
# show any error, and show why we died...
rethrow $dielater;
- } catch {
- print STDERR "$0: $_\n";
- OpenBSD::Handler->reset;
- if ($_ =~ m/^Caught SIG(\w+)/o) {
- kill $1, $$;
- }
- exit(1);
};
+ if ($state->defines('debug')) {
+ &$do;
+ } else {
+ try {
+ &$do;
+ } catch {
+ print STDERR "$0: $_\n";
+ OpenBSD::Handler->reset;
+ if ($_ =~ m/^Caught SIG(\w+)/o) {
+ kill $1, $$;
+ }
+ exit(1);
+ };
+ }
if ($state->{bad}) {
exit(1);