From 888520ee99e73333de39b6978db31cd94da688ea Mon Sep 17 00:00:00 2001 From: David Dollar Date: Thu, 8 Dec 2011 17:59:27 -0800 Subject: [PATCH] fix pipe error --- lib/foreman/process.rb | 4 ++-- spec/foreman/engine_spec.rb | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/foreman/process.rb b/lib/foreman/process.rb index f505584..3d0e74d 100644 --- a/lib/foreman/process.rb +++ b/lib/foreman/process.rb @@ -16,7 +16,7 @@ class Foreman::Process def run(pipe, basedir, environment) Dir.chdir(basedir) do with_environment(environment.merge("PORT" => port.to_s)) do - run_process entry.command + run_process entry.command, pipe end end end @@ -27,7 +27,7 @@ class Foreman::Process private - def run_process(command) + 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 } diff --git a/spec/foreman/engine_spec.rb b/spec/foreman/engine_spec.rb index 42dc939..6fc4393 100644 --- a/spec/foreman/engine_spec.rb +++ b/spec/foreman/engine_spec.rb @@ -24,8 +24,8 @@ describe "Foreman::Engine" do describe "start" do it "forks the processes" do write_procfile - mock.instance_of(Foreman::Process).run_process("./alpha") - mock.instance_of(Foreman::Process).run_process("./bravo") + mock.instance_of(Foreman::Process).run_process("./alpha", is_a(IO)) + mock.instance_of(Foreman::Process).run_process("./bravo", is_a(IO)) mock(subject).watch_for_output mock(subject).watch_for_termination subject.start @@ -34,8 +34,8 @@ describe "Foreman::Engine" do it "handles concurrency" do write_procfile engine = Foreman::Engine.new("Procfile",:concurrency => "alpha=2") - mock.instance_of(Foreman::Process).run_process("./alpha").twice - mock.instance_of(Foreman::Process).run_process("./bravo") + mock.instance_of(Foreman::Process).run_process("./alpha", is_a(IO)).twice + mock.instance_of(Foreman::Process).run_process("./bravo", is_a(IO)) mock(engine).watch_for_output mock(engine).watch_for_termination engine.start