display error when process doesnt exist and is run by name
This commit is contained in:
1 parent
f3c1e76860
commit
f6ef5a5b4f
2 files changed
+7
No files matched your search
@@ -41,6 +41,7 @@ class Foreman::Engine
|
|||||||
end
|
end
|
||||||
|
|
||||||
def execute(name)
|
def execute(name)
|
||||||
|
error "no such process: #{name}" unless procfile[name]
|
||||||
fork procfile[name]
|
fork procfile[name]
|
||||||
|
|
||||||
trap("TERM") { puts "SIGTERM received"; terminate_gracefully }
|
trap("TERM") { puts "SIGTERM received"; terminate_gracefully }
|
||||||
|
|||||||
@@ -48,6 +48,12 @@ describe "Foreman::Engine" do
|
|||||||
mock(subject).watch_for_termination
|
mock(subject).watch_for_termination
|
||||||
subject.execute("alpha")
|
subject.execute("alpha")
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe "environment" do
|
describe "environment" do
|
||||||
|
|||||||
Reference in new issue
Block a user