codeclimate 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cc/analyzer/engine.rb +15 -16
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c27de0831fa129000098f12d91528b6d7a61f5e
|
4
|
+
data.tar.gz: 14e1310aeb2dd8cc50dad5016e02cde02f0dcae9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f56f4e6b86b97679bda4548368c0cdab0fc50a64ef4ec3f6d4aced78d50c904d42a5b06afd77427bc741742e7c178da90b629be4630ae1f84dbaeaab5f8dc67
|
7
|
+
data.tar.gz: 5853393a51ff7096529f683224df9788a81d110aaa27019fbb7e2917eca620f2e9c53af99f38fbd2114fd8ad9c7878c81ad84bff0e6687071e7ee945f7b90449
|
data/lib/cc/analyzer/engine.rb
CHANGED
@@ -17,8 +17,8 @@ module CC
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def run(stdout_io, stderr_io = StringIO.new)
|
20
|
+
timed_out = false
|
20
21
|
pid, _, out, err = POSIX::Spawn.popen4(*docker_run_command)
|
21
|
-
engine_running = true
|
22
22
|
Analyzer.statsd.increment("cli.engines.started")
|
23
23
|
|
24
24
|
t_out = Thread.new do
|
@@ -35,35 +35,34 @@ module CC
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
Thread.new do
|
38
|
+
t_timeout = Thread.new do
|
39
39
|
sleep TIMEOUT
|
40
|
-
|
41
|
-
|
42
|
-
Thread.current.abort_on_exception = true
|
43
|
-
run_command("docker kill #{container_name}")
|
44
|
-
|
45
|
-
Analyzer.statsd.increment("cli.engines.result.error")
|
46
|
-
Analyzer.statsd.increment("cli.engines.result.error.timeout")
|
47
|
-
Analyzer.statsd.increment("cli.engines.names.#{name}.result.error")
|
48
|
-
Analyzer.statsd.increment("cli.engines.names.#{name}.result.error.timeout")
|
49
|
-
raise EngineTimeout, "engine #{name} ran past #{TIMEOUT} seconds and was killed"
|
50
|
-
end
|
40
|
+
run_command("docker kill #{container_name} || true")
|
41
|
+
timed_out = true
|
51
42
|
end
|
52
43
|
|
53
44
|
pid, status = Process.waitpid2(pid)
|
54
|
-
|
45
|
+
t_timeout.kill
|
46
|
+
|
55
47
|
Analyzer.statsd.increment("cli.engines.finished")
|
56
48
|
|
57
|
-
if
|
49
|
+
if timed_out
|
50
|
+
Analyzer.statsd.increment("cli.engines.result.error")
|
51
|
+
Analyzer.statsd.increment("cli.engines.result.error.timeout")
|
52
|
+
Analyzer.statsd.increment("cli.engines.names.#{name}.result.error")
|
53
|
+
Analyzer.statsd.increment("cli.engines.names.#{name}.result.error.timeout")
|
54
|
+
raise EngineTimeout, "engine #{name} ran past #{TIMEOUT} seconds and was killed"
|
55
|
+
elsif status.success?
|
58
56
|
Analyzer.statsd.increment("cli.engines.names.#{name}.result.success")
|
59
57
|
Analyzer.statsd.increment("cli.engines.result.success")
|
60
58
|
else
|
61
59
|
Analyzer.statsd.increment("cli.engines.names.#{name}.result.error")
|
62
60
|
Analyzer.statsd.increment("cli.engines.result.error")
|
63
|
-
|
64
61
|
raise EngineFailure, "engine #{name} failed with status #{status.exitstatus} and stderr #{stderr_io.string.inspect}"
|
65
62
|
end
|
66
63
|
ensure
|
64
|
+
t_timeout.kill if t_timeout
|
65
|
+
|
67
66
|
t_out.join if t_out
|
68
67
|
t_err.join if t_err
|
69
68
|
end
|