Skip to content

Instantly share code, notes, and snippets.

@tsyber1an
Created February 3, 2016 13:20
Show Gist options
  • Save tsyber1an/4c3b2b257f202f16e8f1 to your computer and use it in GitHub Desktop.
Save tsyber1an/4c3b2b257f202f16e8f1 to your computer and use it in GitHub Desktop.
puts "rspec pid: #{Process.pid}"
trap 'USR1' do
threads = Thread.list
puts
puts "=" * 80
puts "Received USR1 signal; printing all #{threads.count} thread backtraces."
threads.each do |thr|
description = thr == Thread.main ? "Main thread" : thr.inspect
puts
puts "#{description} backtrace: "
puts thr.backtrace.join("\n")
end
puts "=" * 80
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment