codeclimate 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cc/analyzer/container.rb +11 -8
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4a00a5adf7f1cc2a98901ee4a953bbd233322a9
4
- data.tar.gz: e3bf21594ba21e22cff4853599af010034f814c5
3
+ metadata.gz: d8770af90b8e05963dd995c4c142087ac71eeada
4
+ data.tar.gz: 99311aa7a9bc5bdc9ad6ab6461897682de279ea4
5
5
  SHA512:
6
- metadata.gz: 3d3baaf44cc288437df80e49cf0772271754a9e0aea94998273039ac97ff63ab2910cfbff653bf64e29cc0af2fb2e2654acccc3f8a46ce22439235787158dcc5
7
- data.tar.gz: 873bf1aadaf48ab5f104bff2b8bcccbc5e44fd74505dfef9f236909e7a7b7c8418fc924aae61032ed60b1a3399f50c533b18cc314bfea402d73a0f0d65f05431
6
+ metadata.gz: c984c9afbf2061cdc1a7d8ca1b1f3ef771d9204f85a4402aa3719c8a884dd1bc6306e4e4462ddffa3062eef6759cef19318cf43d72df144a0a88bf5230455486
7
+ data.tar.gz: a848435feb31a98567fdc6a7f767df578b617a07ee798c4ed847fd1c50fbd6e5f7d9ca71cd8a82e3193b8f68382c5cb2ed09b68eaa40be4a139d11049071aa03
@@ -42,13 +42,13 @@ module CC
42
42
  started = Time.now
43
43
  @listener.started(container_data)
44
44
 
45
- @pid, _, out, err = POSIX::Spawn.popen4(*docker_run_command(options))
45
+ pid, _, out, err = POSIX::Spawn.popen4(*docker_run_command(options))
46
46
 
47
47
  t_out = read_stdout(out)
48
48
  t_err = read_stderr(err)
49
- t_timeout = timeout_thread(@pid)
49
+ t_timeout = timeout_thread
50
50
 
51
- _, status = Process.waitpid2(@pid)
51
+ _, status = Process.waitpid2(pid)
52
52
  if @timed_out
53
53
  @listener.timed_out(container_data(duration: @timeout))
54
54
  else
@@ -70,9 +70,7 @@ module CC
70
70
  # Prevents the processing of more output after first error
71
71
  @on_output = ->(*) { }
72
72
 
73
- Process.kill("TERM", @pid) if @pid
74
- rescue Errno::ESRCH
75
- Analyzer.statsd.increment("container.kill_process_rescue")
73
+ reap_running_container
76
74
  end
77
75
 
78
76
  private
@@ -104,17 +102,22 @@ module CC
104
102
  end
105
103
  end
106
104
 
107
- def timeout_thread(pid)
105
+ def timeout_thread
108
106
  Thread.new do
109
107
  sleep @timeout
110
108
  @timed_out = true
111
- Process.kill("KILL", pid)
109
+ reap_running_container
112
110
  end
113
111
  end
114
112
 
115
113
  def container_data(duration: nil, status: nil)
116
114
  ContainerData.new(@image, @name, duration, status, @stderr_io.string)
117
115
  end
116
+
117
+ def reap_running_container
118
+ Analyzer.logger.warn("killing container name=#{@name}")
119
+ POSIX::Spawn::Child.new("docker", "kill", @name)
120
+ end
118
121
  end
119
122
  end
120
123
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codeclimate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code Climate
@@ -257,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
257
257
  version: '0'
258
258
  requirements: []
259
259
  rubyforge_project:
260
- rubygems_version: 2.4.8
260
+ rubygems_version: 2.4.5
261
261
  signing_key:
262
262
  specification_version: 4
263
263
  summary: Code Climate CLI