diff --git a/lib/foreman/engine.rb b/lib/foreman/engine.rb index 57a2102..fcd5ee6 100644 --- a/lib/foreman/engine.rb +++ b/lib/foreman/engine.rb @@ -41,6 +41,7 @@ class Foreman::Engine end def execute(name) + error "no such process: #{name}" unless procfile[name] fork procfile[name] trap("TERM") { puts "SIGTERM received"; terminate_gracefully } diff --git a/spec/foreman/engine_spec.rb b/spec/foreman/engine_spec.rb index 7a20fc2..7e60100 100644 --- a/spec/foreman/engine_spec.rb +++ b/spec/foreman/engine_spec.rb @@ -48,6 +48,12 @@ describe "Foreman::Engine" do mock(subject).watch_for_termination subject.execute("alpha") end + + it "shows an error running a process that doesnt exist" do + write_procfile + mock(subject).puts("ERROR: no such process: foo") + lambda { subject.execute("foo") }.should raise_error(SystemExit) + end end describe "environment" do