foreman 0.48.0 → 0.49.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.
@@ -9,6 +9,6 @@ sigterm() {
9
9
  #trap sigterm SIGTERM
10
10
 
11
11
  while true; do
12
- echo "$NAME: ping"
12
+ echo "$NAME: ping $$"
13
13
  sleep 1
14
14
  done
@@ -12,6 +12,10 @@ module Foreman
12
12
  defined?(RUBY_PLATFORM) and RUBY_PLATFORM == "java"
13
13
  end
14
14
 
15
+ def self.ruby_18?
16
+ defined?(RUBY_VERSION) and RUBY_VERSION =~ /^1\.8\.\d+/
17
+ end
18
+
15
19
  def self.windows?
16
20
  defined?(RUBY_PLATFORM) and RUBY_PLATFORM =~ /(win|w)32$/
17
21
  end
@@ -99,13 +99,7 @@ class Foreman::Engine
99
99
  # @param [String] signal The signal to send to each process
100
100
  #
101
101
  def killall(signal="SIGTERM")
102
- @running.each do |pid, (process, index)|
103
- system "sending #{signal} to #{name_for(pid)} at pid #{pid}"
104
- begin
105
- Process.kill(signal, -1 * pid)
106
- rescue Errno::ESRCH, Errno::EPERM
107
- end
108
- end
102
+ Process.kill "-#{signal}", Process.pid
109
103
  end
110
104
 
111
105
  # Get the process formation
@@ -266,7 +260,7 @@ private
266
260
  loop do
267
261
  (IO.select(@readers.values).first || []).each do |reader|
268
262
  data = reader.gets
269
- output_with_mutex name_for(@readers.key(reader)), data
263
+ output_with_mutex name_for(@readers.invert[reader]), data
270
264
  end
271
265
  end
272
266
  rescue Exception => ex
@@ -36,16 +36,25 @@ class Foreman::Process
36
36
 
37
37
  if Foreman.windows?
38
38
  Dir.chdir(cwd) do
39
- Process.spawn env, command, :out => output, :err => output, :new_pgroup => true
39
+ Process.spawn env, command, :out => output, :err => output
40
40
  end
41
41
  elsif Foreman.jruby?
42
42
  Dir.chdir(cwd) do
43
43
  require "posix/spawn"
44
- POSIX::Spawn.spawn env, command, :out => output, :err => output, :pgroup => 0
44
+ POSIX::Spawn.spawn env, command, :out => output, :err => output
45
+ end
46
+ elsif Foreman.ruby_18?
47
+ Dir.chdir(cwd) do
48
+ fork do
49
+ $stdout.reopen output
50
+ $stderr.reopen output
51
+ env.each { |k,v| ENV[k] = v }
52
+ exec command
53
+ end
45
54
  end
46
55
  else
47
56
  Dir.chdir(cwd) do
48
- Process.spawn env, command, :out => output, :err => output, :pgroup => 0
57
+ Process.spawn env, command, :out => output, :err => output
49
58
  end
50
59
  end
51
60
  end
@@ -55,7 +64,7 @@ class Foreman::Process
55
64
  # @param [String] signal The signal to send
56
65
  #
57
66
  def kill(signal)
58
- pid && Process.kill(signal, -1 * pid)
67
+ pid && Process.kill("-#{signal}", pid)
59
68
  rescue Errno::ESRCH
60
69
  false
61
70
  end
@@ -1,5 +1,5 @@
1
1
  module Foreman
2
2
 
3
- VERSION = "0.48.0"
3
+ VERSION = "0.49.0"
4
4
 
5
5
  end
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.48.0
4
+ version: 0.49.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-10 00:00:00.000000000 Z
12
+ date: 2012-07-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &70302671508760 !ruby/object:Gem::Requirement
16
+ requirement: &70206504724140 !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: *70302671508760
24
+ version_requirements: *70206504724140
25
25
  description: Process manager for applications with multiple components
26
26
  email: ddollar@gmail.com
27
27
  executables: