Skip to content

Commit

Permalink
hotfix(cli) fix recursive calls to the startup errorhandler
Browse files Browse the repository at this point in the history
The `pcall`s used to stop the services seem to inherit the errorhandler
from the `xpcall` up on the stack. This causes a recursive call if stopping the services
errors for some reason.
  • Loading branch information
Tieske committed Dec 6, 2016
1 parent 35d7772 commit 1b4117b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kong/cmd/start.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ local function execute(args)
assert(nginx_signals.start(conf))
log("Kong started")
end, function(e)
err = e or "" -- cannot throw from this function
end)

if err then
log.verbose("could not start Kong, stopping services")
pcall(nginx_signals.stop(conf))
pcall(serf_signals.stop(conf, dao))
if conf.dnsmasq then
pcall(dnsmasq_signals.stop(conf))
end
err = e -- cannot throw from this function
log.verbose("stopped services")
end)

if err then
error(err) -- report to main error handler
end
end
Expand Down

0 comments on commit 1b4117b

Please sign in to comment.