From f43f2e8db47e4591f382a031959d79aa39fa5421 Mon Sep 17 00:00:00 2001 From: espie Date: Mon, 22 Dec 2014 14:24:56 +0000 Subject: [PATCH] when we run into real errors, the progress meter is distracting, so have a method ->disable that does something nice to the display, and stops the progress meter right before we display our first real error. --- usr.sbin/pkg_add/OpenBSD/PkgCreate.pm | 3 ++- usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm | 5 ++++- usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm | 10 +++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm index e7082f3e057..1a3062aca42 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgCreate.pm,v 1.113 2014/09/21 07:53:19 espie Exp $ +# $OpenBSD: PkgCreate.pm,v 1.114 2014/12/22 14:24:56 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie # @@ -47,6 +47,7 @@ sub error my $self = shift; my $msg = shift; $self->{bad}++; + $self->progress->disable; $self->errsay("Error: $msg", @_); } diff --git a/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm b/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm index 0c65a549f83..f5fdb28370f 100644 --- a/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm +++ b/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: ProgressMeter.pm,v 1.44 2014/11/30 15:56:15 espie Exp $ +# $OpenBSD: ProgressMeter.pm,v 1.45 2014/12/22 14:24:56 espie Exp $ # # Copyright (c) 2010 Marc Espie # @@ -52,6 +52,8 @@ sub setup } } +sub disable {} + sub new_sizer { my ($progress, $plist, $state) = @_; @@ -84,6 +86,7 @@ our @ISA = qw(OpenBSD::ProgressMeter); sub clear {} + sub show {} sub working {} diff --git a/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm b/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm index f2cf4aa9a5e..3819b7e889e 100644 --- a/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm +++ b/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Term.pm,v 1.28 2014/07/08 17:02:56 espie Exp $ +# $OpenBSD: Term.pm,v 1.29 2014/12/22 14:24:56 espie Exp $ # # Copyright (c) 2004-2007 Marc Espie # @@ -273,6 +273,14 @@ sub clear delete $self->{stars}; } +sub disable +{ + my $self = shift; + print "\n" if length($self->{lastdisplay}) > 0; + + bless $self, "OpenBSD::ProgressMeter::Stub"; +} + sub next { my ($self, $todo) = @_; -- 2.20.1