This commit is contained in:
David Dollar
2011-12-08 17:18:21 -08:00
parent 6e95d1ce94
commit c9411cd2b1
2 changed files with 10 additions and 1 deletions
Executable
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
echo "command[$*][$1]"
exec $1 2>&1
+5 -1
View File
@@ -14,8 +14,9 @@ class Foreman::Process
def run(pipe, basedir, environment)
Dir.chdir(basedir) 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
trap("SIGTERM") { "got sigterm for %d" % @pid }
output pipe, "started with pid %d" % @pid
Thread.new do
until io.eof?
@@ -36,6 +37,9 @@ private
pipe.puts "%s,%s" % [ name, message ]
end
def replace_command
end
def with_environment(environment)
old_env = ENV.each_pair.inject({}) { |h,(k,v)| h.update(k => v) }
environment.each { |k,v| ENV[k] = v }