Skip to content

Commit f4dc8e4

Browse files
committed
(maint) Ensure $VERBOSE is restored
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.
1 parent 9c49247 commit f4dc8e4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

spec/lib/puppet_spec/verbose.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
module Kernel
33
def with_verbose_disabled
44
verbose, $VERBOSE = $VERBOSE, nil
5-
result = yield
6-
$VERBOSE = verbose
7-
return result
5+
begin
6+
yield
7+
ensure
8+
$VERBOSE = verbose
9+
end
810
end
911

1012
def with_verbose_enabled

0 commit comments

Comments
 (0)