foreman 0.7.5 → 0.8.0

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.
Files changed (3) hide show
  1. data/lib/foreman.rb +1 -1
  2. data/lib/foreman/engine.rb +7 -9
  3. metadata +5 -5
data/lib/foreman.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Foreman
2
2
 
3
- VERSION = "0.7.5"
3
+ VERSION = "0.8.0"
4
4
 
5
5
  class AppDoesNotExist < Exception; end
6
6
 
@@ -39,8 +39,8 @@ class Foreman::Engine
39
39
  fork process, options
40
40
  end
41
41
 
42
- trap("TERM") { kill_and_exit("TERM") }
43
- trap("INT") { kill_and_exit("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") { kill_and_exit("TERM") }
52
- trap("INT") { kill_and_exit("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 kill_and_exit(signal="TERM")
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
- kill_and_exit
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: 9
4
+ hash: 63
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 7
9
- - 5
10
- version: 0.7.5
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-17 00:00:00 -04:00
20
+ date: 2010-09-20 00:00:00 -04:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency