summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/State.pm
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/State.pm')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/State.pm27
1 files changed, 24 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/State.pm b/usr.sbin/pkg_add/OpenBSD/State.pm
index c5d2d544bd2..3c847c88066 100644
--- a/usr.sbin/pkg_add/OpenBSD/State.pm
+++ b/usr.sbin/pkg_add/OpenBSD/State.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: State.pm,v 1.8 2010/06/30 10:41:42 espie Exp $
+# $OpenBSD: State.pm,v 1.9 2010/06/30 10:51:04 espie Exp $
#
# Copyright (c) 2007-2010 Marc Espie <espie@openbsd.org>
#
@@ -178,7 +178,11 @@ sub print
sub say
{
my $self = shift;
- $self->_print($self->f(@_), "\n");
+ if (@_ == 0) {
+ $self->_print("\n");
+ } else {
+ $self->_print($self->f(@_), "\n");
+ }
}
sub errprint
@@ -190,7 +194,11 @@ sub errprint
sub errsay
{
my $self = shift;
- $self->_errprint($self->f(@_), "\n");
+ if (@_ == 0) {
+ $self->_errprint("\n");
+ } else {
+ $self->_errprint($self->f(@_), "\n");
+ }
}
sub do_options
@@ -302,6 +310,19 @@ sub system
return $r;
}
+sub verbose_system
+{
+ my $self = shift;
+
+ $self->print("Running #1", join(' ', @_));
+ my $r = CORE::system(@_);
+ if ($r != 0) {
+ $self->say("... failed: #1", $self->child_error);
+ } else {
+ $self->say;
+ }
+}
+
sub copy_file
{
my $self = shift;