Skip to content

Commit

Permalink
(maint) Ensure $VERBOSE is restored
Browse files Browse the repository at this point in the history
If the block passed to `with_verbose_disabled` raised, then $VERBOSE wasn't
restored to its original value. This method isn't used in puppet, but has been
here a long time, so guard against the issue instead of removing the method.
  • Loading branch information
joshcooper committed Oct 17, 2023
1 parent 9c49247 commit f4dc8e4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions spec/lib/puppet_spec/verbose.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
module Kernel
def with_verbose_disabled
verbose, $VERBOSE = $VERBOSE, nil
result = yield
$VERBOSE = verbose
return result
begin
yield
ensure
$VERBOSE = verbose
end
end

def with_verbose_enabled
Expand Down

0 comments on commit f4dc8e4

Please sign in to comment.