foreman 0.7.5 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/foreman.rb +1 -1
- data/lib/foreman/engine.rb +7 -9
- metadata +5 -5
data/lib/foreman.rb
CHANGED
data/lib/foreman/engine.rb
CHANGED
@@ -39,8 +39,8 @@ class Foreman::Engine
|
|
39
39
|
fork process, options
|
40
40
|
end
|
41
41
|
|
42
|
-
trap("TERM") {
|
43
|
-
trap("INT") {
|
42
|
+
trap("TERM") { puts "SIGTERM received"; kill_all("TERM") }
|
43
|
+
trap("INT") { puts "SIGINT received"; kill_all("INT") }
|
44
44
|
|
45
45
|
watch_for_termination
|
46
46
|
end
|
@@ -48,8 +48,8 @@ class Foreman::Engine
|
|
48
48
|
def execute(name, options={})
|
49
49
|
fork processes[name], options
|
50
50
|
|
51
|
-
trap("TERM") {
|
52
|
-
trap("INT") {
|
51
|
+
trap("TERM") { puts "SIGTERM received"; kill_all("TERM") }
|
52
|
+
trap("INT") { puts "SIGINT received"; kill_all("INT") }
|
53
53
|
|
54
54
|
watch_for_termination
|
55
55
|
end
|
@@ -97,18 +97,15 @@ private ######################################################################
|
|
97
97
|
rescue PTY::ChildExited, Interrupt
|
98
98
|
info "process exiting", process
|
99
99
|
end
|
100
|
-
Process.waitall
|
101
100
|
end
|
102
101
|
end
|
103
102
|
|
104
|
-
def
|
103
|
+
def kill_all(signal="TERM")
|
105
104
|
info "terminating"
|
106
105
|
running_processes.each do |pid, process|
|
107
106
|
info "killing #{process.name} in pid #{pid}"
|
108
107
|
Process.kill(signal, pid)
|
109
108
|
end
|
110
|
-
Process.waitall
|
111
|
-
exit 0
|
112
109
|
end
|
113
110
|
|
114
111
|
def info(message, process=nil)
|
@@ -151,7 +148,8 @@ private ######################################################################
|
|
151
148
|
pid, status = Process.wait2
|
152
149
|
process = running_processes.delete(pid)
|
153
150
|
info "process terminated", process
|
154
|
-
|
151
|
+
kill_all
|
152
|
+
Process.waitall
|
155
153
|
end
|
156
154
|
|
157
155
|
def running_processes
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 63
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 8
|
9
|
+
- 0
|
10
|
+
version: 0.8.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- |
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-09-
|
20
|
+
date: 2010-09-20 00:00:00 -04:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|