wip
This commit is contained in:
Executable
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "command[$*][$1]"
|
||||||
|
|
||||||
|
exec $1 2>&1
|
||||||
@@ -14,8 +14,9 @@ class Foreman::Process
|
|||||||
def run(pipe, basedir, environment)
|
def run(pipe, basedir, environment)
|
||||||
Dir.chdir(basedir) do
|
Dir.chdir(basedir) do
|
||||||
with_environment(environment) do
|
with_environment(environment) do
|
||||||
io = IO.popen("#{entry.command} $FOO 2>&1", "w+")
|
io = IO.popen(["/Users/david/Code/foreman/bin/runner", "#{entry.command}"], "w+")
|
||||||
@pid = io.pid
|
@pid = io.pid
|
||||||
|
trap("SIGTERM") { "got sigterm for %d" % @pid }
|
||||||
output pipe, "started with pid %d" % @pid
|
output pipe, "started with pid %d" % @pid
|
||||||
Thread.new do
|
Thread.new do
|
||||||
until io.eof?
|
until io.eof?
|
||||||
@@ -36,6 +37,9 @@ private
|
|||||||
pipe.puts "%s,%s" % [ name, message ]
|
pipe.puts "%s,%s" % [ name, message ]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def replace_command
|
||||||
|
end
|
||||||
|
|
||||||
def with_environment(environment)
|
def with_environment(environment)
|
||||||
old_env = ENV.each_pair.inject({}) { |h,(k,v)| h.update(k => v) }
|
old_env = ENV.each_pair.inject({}) { |h,(k,v)| h.update(k => v) }
|
||||||
environment.each { |k,v| ENV[k] = v }
|
environment.each { |k,v| ENV[k] = v }
|
||||||
|
|||||||
Reference in New Issue
Block a user