foreman 0.49.0 → 0.50.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/foreman/engine.rb +21 -3
- data/lib/foreman/engine/cli.rb +3 -1
- data/lib/foreman/process.rb +10 -2
- data/lib/foreman/version.rb +1 -1
- data/man/foreman.1 +1 -1
- metadata +10 -3
data/lib/foreman/engine.rb
CHANGED
@@ -99,7 +99,20 @@ class Foreman::Engine
|
|
99
99
|
# @param [String] signal The signal to send to each process
|
100
100
|
#
|
101
101
|
def killall(signal="SIGTERM")
|
102
|
-
|
102
|
+
if Foreman.windows?
|
103
|
+
@running.each do |pid, (process, index)|
|
104
|
+
system "sending #{signal} to #{name_for(pid)} at pid #{pid}"
|
105
|
+
begin
|
106
|
+
Process.kill(signal, pid)
|
107
|
+
rescue Errno::ESRCH, Errno::EPERM
|
108
|
+
end
|
109
|
+
end
|
110
|
+
else
|
111
|
+
begin
|
112
|
+
Process.kill "-#{signal}", Process.pid
|
113
|
+
rescue Errno::ESRCH, Errno::EPERM
|
114
|
+
end
|
115
|
+
end
|
103
116
|
end
|
104
117
|
|
105
118
|
# Get the process formation
|
@@ -282,8 +295,13 @@ private
|
|
282
295
|
def terminate_gracefully
|
283
296
|
return if @terminating
|
284
297
|
@terminating = true
|
285
|
-
|
286
|
-
|
298
|
+
if Foreman.windows?
|
299
|
+
system "sending SIGKILL to all processes"
|
300
|
+
killall "SIGKILL"
|
301
|
+
else
|
302
|
+
system "sending SIGTERM to all processes"
|
303
|
+
killall "SIGTERM"
|
304
|
+
end
|
287
305
|
Timeout.timeout(5) do
|
288
306
|
watch_for_termination while @running.length > 0
|
289
307
|
end
|
data/lib/foreman/engine/cli.rb
CHANGED
@@ -31,6 +31,7 @@ class Foreman::Engine::CLI < Foreman::Engine
|
|
31
31
|
|
32
32
|
def color?
|
33
33
|
return true if @@color_force
|
34
|
+
return true if Foreman.windows?
|
34
35
|
return false unless self.respond_to?(:isatty)
|
35
36
|
self.isatty && ENV["TERM"]
|
36
37
|
end
|
@@ -49,11 +50,12 @@ class Foreman::Engine::CLI < Foreman::Engine
|
|
49
50
|
def startup
|
50
51
|
@colors = map_colors
|
51
52
|
proctitle "foreman: master"
|
53
|
+
require "win32console" if Foreman.windows?
|
54
|
+
Color.enable($stdout, options[:color]) unless $stdout.respond_to?(:color?)
|
52
55
|
end
|
53
56
|
|
54
57
|
def output(name, data)
|
55
58
|
data.to_s.chomp.split("\n").each do |message|
|
56
|
-
Color.enable($stdout, options[:color]) unless $stdout.respond_to?(:color?)
|
57
59
|
output = ""
|
58
60
|
output += $stdout.color(@colors[name.split(".").first].to_sym)
|
59
61
|
output += "#{Time.now.strftime("%H:%M:%S")} #{pad_process_name(name)} | "
|
data/lib/foreman/process.rb
CHANGED
@@ -36,7 +36,11 @@ class Foreman::Process
|
|
36
36
|
|
37
37
|
if Foreman.windows?
|
38
38
|
Dir.chdir(cwd) do
|
39
|
-
|
39
|
+
expanded_command = command.dup
|
40
|
+
env.each do |key, val|
|
41
|
+
expanded_command.gsub!("$#{key}", val)
|
42
|
+
end
|
43
|
+
Process.spawn env, expanded_command, :out => output, :err => output
|
40
44
|
end
|
41
45
|
elsif Foreman.jruby?
|
42
46
|
Dir.chdir(cwd) do
|
@@ -64,7 +68,11 @@ class Foreman::Process
|
|
64
68
|
# @param [String] signal The signal to send
|
65
69
|
#
|
66
70
|
def kill(signal)
|
67
|
-
|
71
|
+
if Foreman.windows?
|
72
|
+
pid && Process.kill(signal, pid)
|
73
|
+
else
|
74
|
+
pid && Process.kill("-#{signal}", pid)
|
75
|
+
end
|
68
76
|
rescue Errno::ESRCH
|
69
77
|
false
|
70
78
|
end
|
data/lib/foreman/version.rb
CHANGED
data/man/foreman.1
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "FOREMAN" "1" "
|
4
|
+
.TH "FOREMAN" "1" "July 2012" "Foreman 0.50.0" "Foreman Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBforeman\fR \- manage Procfile\-based applications
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.50.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-07-11 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement: &
|
16
|
+
requirement: &70273928866960 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 0.13.6
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70273928866960
|
25
25
|
description: Process manager for applications with multiple components
|
26
26
|
email: ddollar@gmail.com
|
27
27
|
executables:
|
@@ -121,12 +121,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
121
121
|
- - ! '>='
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '0'
|
124
|
+
segments:
|
125
|
+
- 0
|
126
|
+
hash: 2988122177042669007
|
124
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
128
|
none: false
|
126
129
|
requirements:
|
127
130
|
- - ! '>='
|
128
131
|
- !ruby/object:Gem::Version
|
129
132
|
version: '0'
|
133
|
+
segments:
|
134
|
+
- 0
|
135
|
+
hash: 2988122177042669007
|
130
136
|
requirements: []
|
131
137
|
rubyforge_project:
|
132
138
|
rubygems_version: 1.8.11
|
@@ -134,3 +140,4 @@ signing_key:
|
|
134
140
|
specification_version: 3
|
135
141
|
summary: Process manager for applications with multiple components
|
136
142
|
test_files: []
|
143
|
+
has_rdoc:
|