fix pipe error

This commit is contained in:
David Dollar
2011-12-08 17:59:27 -08:00
parent c7b6b334fd
commit 888520ee99
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -16,7 +16,7 @@ class Foreman::Process
def run(pipe, basedir, environment) def run(pipe, basedir, environment)
Dir.chdir(basedir) do Dir.chdir(basedir) do
with_environment(environment.merge("PORT" => port.to_s)) do with_environment(environment.merge("PORT" => port.to_s)) do
run_process entry.command run_process entry.command, pipe
end end
end end
end end
@@ -27,7 +27,7 @@ class Foreman::Process
private private
def run_process(command) def run_process(command, pipe)
io = IO.popen([Foreman.runner, replace_command_env(command)], "w+") io = IO.popen([Foreman.runner, replace_command_env(command)], "w+")
@pid = io.pid @pid = io.pid
trap("SIGTERM") { "got sigterm for %d" % @pid } trap("SIGTERM") { "got sigterm for %d" % @pid }
+4 -4
View File
@@ -24,8 +24,8 @@ describe "Foreman::Engine" do
describe "start" do describe "start" do
it "forks the processes" do it "forks the processes" do
write_procfile write_procfile
mock.instance_of(Foreman::Process).run_process("./alpha") mock.instance_of(Foreman::Process).run_process("./alpha", is_a(IO))
mock.instance_of(Foreman::Process).run_process("./bravo") mock.instance_of(Foreman::Process).run_process("./bravo", is_a(IO))
mock(subject).watch_for_output mock(subject).watch_for_output
mock(subject).watch_for_termination mock(subject).watch_for_termination
subject.start subject.start
@@ -34,8 +34,8 @@ describe "Foreman::Engine" do
it "handles concurrency" do it "handles concurrency" do
write_procfile write_procfile
engine = Foreman::Engine.new("Procfile",:concurrency => "alpha=2") engine = Foreman::Engine.new("Procfile",:concurrency => "alpha=2")
mock.instance_of(Foreman::Process).run_process("./alpha").twice mock.instance_of(Foreman::Process).run_process("./alpha", is_a(IO)).twice
mock.instance_of(Foreman::Process).run_process("./bravo") mock.instance_of(Foreman::Process).run_process("./bravo", is_a(IO))
mock(engine).watch_for_output mock(engine).watch_for_output
mock(engine).watch_for_termination mock(engine).watch_for_termination
engine.start engine.start