Compare commits

..

10 Commits

Author SHA1 Message Date
David Dollar
342d30bbb8 0.31.0 2012-01-04 12:16:51 -05:00
David Dollar
268dd6240e make fork more robust 2012-01-04 12:15:55 -05:00
David Dollar
9e60b3e1a4 remove unnecessary debug 2012-01-04 12:15:38 -05:00
David Dollar
1c6285f8af add more information when shutting down 2012-01-04 12:15:17 -05:00
David Dollar
fff15bc627 Merge pull request #110 from lstoll/master
Different port range for each process type on 'foreman start'
2011-12-24 22:47:36 -08:00
Lincoln Stoll
a66157d611 Use different port ranges for each process type 2011-12-25 15:46:21 +11:00
David Dollar
fcfa913fb0 0.30.1 2011-12-23 08:48:34 -05:00
David Dollar
fc438472f9 require thread for mutex 2011-12-23 08:48:17 -05:00
David Dollar
fc95936327 0.30.0 2011-12-22 16:34:02 -05:00
David Dollar
0c27f78d46 compatibility with ruby 1.8 2011-12-22 16:33:49 -05:00
4 changed files with 18 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
PATH
remote: .
specs:
foreman (0.29.0)
foreman (0.31.0)
term-ansicolor (~> 1.0.5)
thor (>= 0.13.6)

View File

@@ -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
@@ -115,7 +117,7 @@ private ######################################################################
print "#{Time.now.strftime("%H:%M:%S")} #{pad_process_name(name)} | "
print Term::ANSIColor.reset
print message.chomp
puts
puts ""
end
def print(message=nil)

View File

@@ -27,10 +27,19 @@ class Foreman::Process
private
def fork_with_io(command)
reader, writer = IO.pipe
pid = fork do
trap("INT", "IGNORE")
$stdout.reopen writer
reader.close
exec Foreman.runner, replace_command_env(command)
end
[ reader, pid ]
end
def run_process(command, pipe)
io = IO.popen([Foreman.runner, replace_command_env(command)], "w+")
@pid = io.pid
trap("SIGTERM") { "got sigterm for %d" % @pid }
io, @pid = fork_with_io(command)
output pipe, "started with pid %d" % @pid
Thread.new do
until io.eof?

View File

@@ -1,5 +1,5 @@
module Foreman
VERSION = "0.29.0"
VERSION = "0.31.0"
end