File: send_sigint_during_bisect.rb

package info (click to toggle)
ruby-rspec 3.4.0c3e0m1s1-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 6,124 kB
  • sloc: ruby: 59,418; sh: 1,405; makefile: 98
file content (21 lines) | stat: -rw-r--r-- 763 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require 'rspec/core'
RSpec::Support.require_rspec_core "formatters/bisect_progress_formatter"

module RSpec::Core::Formatters
  BisectProgressFormatter = Class.new(remove_const :BisectProgressFormatter) do
    RSpec::Core::Formatters.register self

    def bisect_round_started(notification)
      return super unless @round_count == 3

      Process.kill("INT", Process.pid)
      # Process.kill is not a synchronous call, so to ensure the output
      # below aborts at a deterministic place, we need to block here.
      # The sleep will be interrupted by the signal once the OS sends it.
      # For the most part, this is only needed on JRuby, but we saw
      # the asynchronous behavior on an MRI 2.0 travis build as well.
      sleep 5
    end
  end
end