Skip to content

Commit c3d972d

Browse files
jawshooahsds
authored andcommittedMar 20, 2015
Ensure environment is restored on error
Fixes sds#129 Change-Id: I1947b1b508dea94fa2f1024123d16df29b6329a3 Reviewed-on: http://gerrit.causes.com/48044 Tested-by: jenkins <jenkins@brigade.com> Reviewed-by: Shane da Silva <shane.dasilva@brigade.com>
1 parent 5a45e4f commit c3d972d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed
 

‎lib/overcommit/hook_runner.rb

+7-5
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ def run
2222
# these calls to allow some sort of "are you sure?" double-interrupt
2323
# functionality, but until that's deemed necessary let's keep it simple.
2424
InterruptHandler.isolate_from_interrupts do
25-
@context.setup_environment
26-
load_hooks
27-
result = run_hooks
28-
@context.cleanup_environment
29-
result
25+
begin
26+
@context.setup_environment
27+
load_hooks
28+
run_hooks
29+
ensure
30+
@context.cleanup_environment
31+
end
3032
end
3133
end
3234

0 commit comments

Comments
 (0)