Skip to content

Commit 8c04853

Browse files
committed
Check subprocess leaks in the LeakChecker
1 parent 5b1f519 commit 8c04853

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/mspec/runner/actions/leakchecker.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ def check(test_name)
3838
@no_leaks = true
3939
leaks = [
4040
check_fd_leak(test_name),
41-
check_thread_leak(test_name),
4241
check_tempfile_leak(test_name),
42+
check_thread_leak(test_name),
43+
check_process_leak(test_name),
4344
check_env(test_name),
4445
check_argv(test_name),
4546
check_encodings(test_name)
@@ -198,6 +199,14 @@ def check_thread_leak(test_name)
198199
return leaked
199200
end
200201

202+
def check_process_leak(test_name)
203+
subprocesses_leaked = Process.waitall
204+
subprocesses_leaked.each { |pid, status|
205+
puts "Leaked subprocess: #{pid}: #{status}"
206+
}
207+
return !subprocesses_leaked.empty?
208+
end
209+
201210
def find_env
202211
ENV.to_h
203212
end

0 commit comments

Comments
 (0)