Skip to content

Commit

Permalink
display error when process doesnt exist and is run by name
Browse files Browse the repository at this point in the history
  • Loading branch information
ddollar committed Nov 8, 2011
1 parent f3c1e76 commit f6ef5a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/foreman/engine.rb
Expand Up @@ -41,6 +41,7 @@ def start
end

def execute(name)
error "no such process: #{name}" unless procfile[name]
fork procfile[name]

trap("TERM") { puts "SIGTERM received"; terminate_gracefully }
Expand Down
6 changes: 6 additions & 0 deletions spec/foreman/engine_spec.rb
Expand Up @@ -48,6 +48,12 @@
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
Expand Down

0 comments on commit f6ef5a5

Please sign in to comment.