Skip to content

Commit 736369b

Browse files
committed
Land rapid7#14905, Use ensure to run exploit cleanup
2 parents 6cecc02 + 83d757f commit 736369b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/msf/core/exploit_driver.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,13 @@ def run
166166

167167
begin
168168
job_run_proc(ctx)
169-
# For multi exploit targets.
170-
# Keep the payload handler until last target or interrupt
171-
job_cleanup_proc(ctx) unless keep_handler
172169
rescue ::Interrupt
173170
job_cleanup_proc(ctx)
174171
raise $!
172+
ensure
173+
# For multi exploit targets.
174+
# Keep the payload handler until last target or interrupt
175+
job_cleanup_proc(ctx) unless keep_handler
175176
end
176177
end
177178

0 commit comments

Comments
 (0)