acpc_dealer 2.4.0 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/acpc_dealer.rb +12 -2
- data/lib/acpc_dealer/version.rb +1 -1
- 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: c4fa53f651257274bf2aef2413cce48c12293cc2
|
4
|
+
data.tar.gz: df26215d5c964c16c787474f3e3a903979eabec0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3d5cf620ff3c03cd4e1fcf9c881866288eeae0e2020dbe7a5d5ad16e8140d840e2f200f26d20a838ef0c6ef5db9613bd0da81741a376a87fe76c6136a0603c2
|
7
|
+
data.tar.gz: f315138fc37434e1941dab2c8c0adf237e7b31fa12f25ceecfbea45960a3b7220153f59509a2b9c609dcf22f7aded0a4543cf58893a27b33d0f8d9443f3cfec8
|
data/lib/acpc_dealer.rb
CHANGED
@@ -54,11 +54,22 @@ module AcpcDealer
|
|
54
54
|
"#{players.join('-')}.#{game_def}.r#{seed}.#{date}"
|
55
55
|
end
|
56
56
|
|
57
|
+
def self.process_exists?(pid)
|
58
|
+
begin
|
59
|
+
Process.getpgid pid
|
60
|
+
true
|
61
|
+
rescue Errno::ESRCH
|
62
|
+
false
|
63
|
+
end
|
64
|
+
end
|
65
|
+
def self.kill_process(pid) Process.kill('TERM', pid) end
|
66
|
+
def self.force_kill_process(pid) Process.kill('KILL', pid) end
|
67
|
+
|
57
68
|
def self.dealer_running?(dealer_process_hash)
|
58
69
|
(
|
59
70
|
dealer_process_hash &&
|
60
71
|
dealer_process_hash[:pid] &&
|
61
|
-
dealer_process_hash[:pid]
|
72
|
+
process_exists?(dealer_process_hash[:pid])
|
62
73
|
)
|
63
74
|
end
|
64
75
|
|
@@ -80,7 +91,6 @@ module AcpcDealer
|
|
80
91
|
end
|
81
92
|
rescue Timeout::Error
|
82
93
|
end
|
83
|
-
|
84
94
|
return false
|
85
95
|
end
|
86
96
|
|
data/lib/acpc_dealer/version.rb
CHANGED