Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
342d30bbb8 | ||
|
|
268dd6240e | ||
|
|
9e60b3e1a4 | ||
|
|
1c6285f8af | ||
|
|
fff15bc627 | ||
|
|
a66157d611 | ||
|
|
fcfa913fb0 | ||
|
|
fc438472f9 |
@@ -1,7 +1,7 @@
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
foreman (0.30.0)
|
||||
foreman (0.31.0)
|
||||
term-ansicolor (~> 1.0.5)
|
||||
thor (>= 0.13.6)
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ require "tempfile"
|
||||
require "timeout"
|
||||
require "term/ansicolor"
|
||||
require "fileutils"
|
||||
require "thread"
|
||||
|
||||
class Foreman::Engine
|
||||
|
||||
@@ -57,7 +58,7 @@ private ######################################################################
|
||||
|
||||
procfile.entries.each do |entry|
|
||||
reader, writer = IO.pipe
|
||||
entry.spawn(concurrency[entry.name], writer, @directory, @environment, base_port).each do |process|
|
||||
entry.spawn(concurrency[entry.name], writer, @directory, @environment, port_for(entry, 1, base_port)).each do |process|
|
||||
running_processes[process.pid] = process
|
||||
readers[process] = reader
|
||||
end
|
||||
@@ -70,6 +71,7 @@ private ######################################################################
|
||||
|
||||
def kill_all(signal="SIGTERM")
|
||||
running_processes.each do |pid, process|
|
||||
info "sending #{signal} to pid #{pid}"
|
||||
Process.kill(signal, pid) rescue Errno::ESRCH
|
||||
end
|
||||
end
|
||||
|
||||
@@ -28,21 +28,18 @@ class Foreman::Process
|
||||
private
|
||||
|
||||
def fork_with_io(command)
|
||||
io = case RUBY_VERSION
|
||||
when /^1\.9\./
|
||||
IO.popen([Foreman.runner, replace_command_env(command)], "w+")
|
||||
when /^1\.8\./
|
||||
full_command = replace_command_env(command).gsub("'", "\\'")
|
||||
IO.popen("#{Foreman.runner} '#{full_command}'", "w+")
|
||||
else
|
||||
raise "Unknown Ruby version: #{RUBY_VERSION}"
|
||||
reader, writer = IO.pipe
|
||||
pid = fork do
|
||||
trap("INT", "IGNORE")
|
||||
$stdout.reopen writer
|
||||
reader.close
|
||||
exec Foreman.runner, replace_command_env(command)
|
||||
end
|
||||
[ io, io.pid ]
|
||||
[ reader, pid ]
|
||||
end
|
||||
|
||||
def run_process(command, pipe)
|
||||
io, @pid = fork_with_io(command)
|
||||
trap("SIGTERM") { "got sigterm for %d" % @pid }
|
||||
output pipe, "started with pid %d" % @pid
|
||||
Thread.new do
|
||||
until io.eof?
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module Foreman
|
||||
|
||||
VERSION = "0.30.0"
|
||||
VERSION = "0.31.0"
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user