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