Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9849f4558a | ||
|
|
4b53b42be1 | ||
|
|
219acaf690 | ||
|
|
f8118d7b40 |
@@ -1,7 +1,7 @@
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
foreman (0.48.0)
|
||||
foreman (0.49.0)
|
||||
thor (>= 0.13.6)
|
||||
|
||||
GEM
|
||||
@@ -39,7 +39,7 @@ GEM
|
||||
multi_json (~> 1.0.3)
|
||||
simplecov-html (~> 0.5.3)
|
||||
simplecov-html (0.5.3)
|
||||
thor (0.15.3)
|
||||
thor (0.15.4)
|
||||
timecop (0.3.5)
|
||||
win32console (1.3.0-x86-mingw32)
|
||||
xml-simple (1.0.15)
|
||||
|
||||
@@ -9,6 +9,6 @@ sigterm() {
|
||||
#trap sigterm SIGTERM
|
||||
|
||||
while true; do
|
||||
echo "$NAME: ping"
|
||||
echo "$NAME: ping $$"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
@@ -12,6 +12,10 @@ module Foreman
|
||||
defined?(RUBY_PLATFORM) and RUBY_PLATFORM == "java"
|
||||
end
|
||||
|
||||
def self.ruby_18?
|
||||
defined?(RUBY_VERSION) and RUBY_VERSION =~ /^1\.8\.\d+/
|
||||
end
|
||||
|
||||
def self.windows?
|
||||
defined?(RUBY_PLATFORM) and RUBY_PLATFORM =~ /(win|w)32$/
|
||||
end
|
||||
|
||||
@@ -99,13 +99,7 @@ class Foreman::Engine
|
||||
# @param [String] signal The signal to send to each process
|
||||
#
|
||||
def killall(signal="SIGTERM")
|
||||
@running.each do |pid, (process, index)|
|
||||
system "sending #{signal} to #{name_for(pid)} at pid #{pid}"
|
||||
begin
|
||||
Process.kill(signal, -1 * pid)
|
||||
rescue Errno::ESRCH, Errno::EPERM
|
||||
end
|
||||
end
|
||||
Process.kill "-#{signal}", Process.pid
|
||||
end
|
||||
|
||||
# Get the process formation
|
||||
@@ -266,7 +260,7 @@ private
|
||||
loop do
|
||||
(IO.select(@readers.values).first || []).each do |reader|
|
||||
data = reader.gets
|
||||
output_with_mutex name_for(@readers.key(reader)), data
|
||||
output_with_mutex name_for(@readers.invert[reader]), data
|
||||
end
|
||||
end
|
||||
rescue Exception => ex
|
||||
|
||||
@@ -36,16 +36,25 @@ class Foreman::Process
|
||||
|
||||
if Foreman.windows?
|
||||
Dir.chdir(cwd) do
|
||||
Process.spawn env, command, :out => output, :err => output, :new_pgroup => true
|
||||
Process.spawn env, command, :out => output, :err => output
|
||||
end
|
||||
elsif Foreman.jruby?
|
||||
Dir.chdir(cwd) do
|
||||
require "posix/spawn"
|
||||
POSIX::Spawn.spawn env, command, :out => output, :err => output, :pgroup => 0
|
||||
POSIX::Spawn.spawn env, command, :out => output, :err => output
|
||||
end
|
||||
elsif Foreman.ruby_18?
|
||||
Dir.chdir(cwd) do
|
||||
fork do
|
||||
$stdout.reopen output
|
||||
$stderr.reopen output
|
||||
env.each { |k,v| ENV[k] = v }
|
||||
exec command
|
||||
end
|
||||
end
|
||||
else
|
||||
Dir.chdir(cwd) do
|
||||
Process.spawn env, command, :out => output, :err => output, :pgroup => 0
|
||||
Process.spawn env, command, :out => output, :err => output
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -55,7 +64,7 @@ class Foreman::Process
|
||||
# @param [String] signal The signal to send
|
||||
#
|
||||
def kill(signal)
|
||||
pid && Process.kill(signal, -1 * pid)
|
||||
pid && Process.kill("-#{signal}", pid)
|
||||
rescue Errno::ESRCH
|
||||
false
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module Foreman
|
||||
|
||||
VERSION = "0.48.0"
|
||||
VERSION = "0.49.0"
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user