parallel_tests 2.16.1 → 2.17.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b2003719fa857ffb865c2c178bff803728424a1
4
- data.tar.gz: ee97e7c69df23ea4fe53a10057370f30d0bd22eb
3
+ metadata.gz: f1f4bfdd3a1b255d2f95ad98dc11564cc137fe08
4
+ data.tar.gz: b273836c89a6e65c756797a52994bdd6f4078376
5
5
  SHA512:
6
- metadata.gz: d8cb151d3a41c56cbf4b3d873e29e1a48864d66748a803767a028aa112fa70813c656596fdbf5a0e529b9afde36d50c284427516ed7431cd20351269f68346fa
7
- data.tar.gz: 5a97484869c279c8146cdde8b809b7f29a3f91302786dca569c79476e2cd74d2d108a9af6b69983a7c076bf52fd8956847cc187ff868779bd8ed50f5914a1904
6
+ metadata.gz: c326454b909a928bd01295ced39cc7e7ef7a9cd411422cc6c869f07cc77787e4050e816e17f9d923d740f31d285e942942cfc2e21ec0610614ed645098c21bae
7
+ data.tar.gz: a8e3a767d91ca441f8c9adf5fb1f2f16498cde3bee2f556e56196962e67f10af4c078aa3b30081291ec6ca78ff2d2e5c8ddc8080ae08344a7626c6e55863cdb7
@@ -28,6 +28,10 @@ module ParallelTests
28
28
  ENV['PARALLEL_PID_FILE'] ||= Tempfile.new('parallel-tests-pidfile').path
29
29
  end
30
30
 
31
+ def stop_all_processes
32
+ pids.all.each { |pid| Process.kill(:INT, pid) }
33
+ end
34
+
31
35
  # copied from http://github.com/carlhuda/bundler Bundler::SharedHelpers#find_gemfile
32
36
  def bundler_enabled?
33
37
  return true if Object.const_defined?(:Bundler)
@@ -6,6 +6,8 @@ require 'shellwords'
6
6
  module ParallelTests
7
7
  class CLI
8
8
  def run(argv)
9
+ Signal.trap("INT") { handle_interrupt }
10
+
9
11
  options = parse_options!(argv)
10
12
 
11
13
  ENV['DISABLE_SPRING'] ||= '1'
@@ -24,6 +26,17 @@ module ParallelTests
24
26
 
25
27
  private
26
28
 
29
+ def handle_interrupt
30
+ @graceful_shutdown_attempted ||= false
31
+ Kernel.exit if @graceful_shutdown_attempted
32
+
33
+ # The Pid class's synchronize method can't be called directly from a trap
34
+ # Using Thread workaround https://github.com/ddollar/foreman/issues/332
35
+ Thread.new { ParallelTests.stop_all_processes }
36
+
37
+ @graceful_shutdown_attempted = true
38
+ end
39
+
27
40
  def execute_in_parallel(items, num_processes, options)
28
41
  Tempfile.open 'parallel_tests-lock' do |lock|
29
42
  progress_indicator = simulate_output_for_ci if options[:serialize_stdout]
@@ -25,17 +25,17 @@ module ParallelTests
25
25
  pids.count
26
26
  end
27
27
 
28
+ def all
29
+ read
30
+ pids
31
+ end
32
+
28
33
  private
29
34
 
30
35
  def pids
31
36
  @pids ||= []
32
37
  end
33
38
 
34
- def all
35
- read
36
- pids
37
- end
38
-
39
39
  def clear
40
40
  @pids = []
41
41
  save
@@ -1,3 +1,3 @@
1
1
  module ParallelTests
2
- VERSION = Version = '2.16.1'
2
+ VERSION = Version = '2.17.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.16.1
4
+ version: 2.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-01 00:00:00.000000000 Z
11
+ date: 2017-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel