Skip to content

Commit 4c01004

Browse files
committed
Ensure thread_pool.join runs even when an exception is raised
Move thread_pool.join and job stats reporting into an ensure block so that all threads are properly joined before rake exits, even when a task raises an exception. Previously, an exception in a multitask prerequisite could cause rake to exit while subprocesses were still running. Fixes #414
1 parent dbeb18c commit 4c01004

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/rake/application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def run_with_threads
146146
thread_pool.gather_history if options.job_stats == :history
147147

148148
yield
149-
149+
ensure
150150
thread_pool.join if defined?(@thread_pool)
151151
if options.job_stats
152152
stats = thread_pool.statistics

0 commit comments

Comments
 (0)