dapp 0.31.4 → 0.31.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/dapp +64 -0
- data/lib/dapp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22cc8594fb78a6243a99c16f7f1a501b06ee1286b83c3524978500d5f35ee731
|
4
|
+
data.tar.gz: 4143dab497bcde117a36136f0bd780cb1f6a2d539c8d5ec431f1e7ca2a1aa831
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86c27a5b641793dd2b1ac46d493b78474495f327056b490cd9c83353b12a55728dae98d5899ebab99dbd4d31727066f89d5f4e1ab7ac2d9aac0bd865bad7ffbb
|
7
|
+
data.tar.gz: 71f48d1aa6e29c7b7bf0465de3e460cd8ef828ea8e46a54edae24a7625ff99276953f9aaa0e94965c39b7762a13f78614157bb32db6a1d13b0aeb3f8675f95af
|
data/bin/dapp
CHANGED
@@ -7,6 +7,70 @@ require 'dapp'
|
|
7
7
|
|
8
8
|
Thread.abort_on_exception = true
|
9
9
|
|
10
|
+
def get_process_parent_pid(pid)
|
11
|
+
path = File.join("/proc", pid.to_s, "status")
|
12
|
+
if File.exists? path
|
13
|
+
ppid_line = File.read(path).lines.find {|line| line.split("\t").first == "PPid:"}
|
14
|
+
ppid = ppid_line.strip.split("\t").last.to_i
|
15
|
+
|
16
|
+
# zero is nil
|
17
|
+
ppid if ppid != 0
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def process_alive?(pid)
|
22
|
+
begin
|
23
|
+
Process.kill(0, pid)
|
24
|
+
true
|
25
|
+
rescue ::Errno::EPERM
|
26
|
+
true
|
27
|
+
rescue ::Errno::ESRCH
|
28
|
+
# no such process
|
29
|
+
false
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def get_parents
|
34
|
+
pid = Process.pid
|
35
|
+
parents = []
|
36
|
+
|
37
|
+
loop do
|
38
|
+
ppid = get_process_parent_pid(pid)
|
39
|
+
break unless ppid
|
40
|
+
parents << ppid
|
41
|
+
pid = ppid
|
42
|
+
end
|
43
|
+
|
44
|
+
parents
|
45
|
+
end
|
46
|
+
|
47
|
+
def set_gitlab_cancel_handler
|
48
|
+
parents_pids = get_parents
|
49
|
+
|
50
|
+
Thread.new do
|
51
|
+
loop do
|
52
|
+
cancelled = false
|
53
|
+
|
54
|
+
parents_pids.each do |pid|
|
55
|
+
if not process_alive? pid
|
56
|
+
File.open(File.join(ENV["HOME"], ".dapp", "cancelled"), "a") do |file|
|
57
|
+
file.write "#{Process.pid}\n"
|
58
|
+
end
|
59
|
+
|
60
|
+
Process.kill("INT", Process.pid)
|
61
|
+
cancelled = true
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
break if cancelled
|
66
|
+
|
67
|
+
sleep 1
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
set_gitlab_cancel_handler if ENV["GITLAB_CI"]
|
73
|
+
|
10
74
|
begin
|
11
75
|
begin
|
12
76
|
begin
|
data/lib/dapp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.31.
|
4
|
+
version: 0.31.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Stolyarov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|