Skip to content

Commit

Permalink
core.app: fix bug in snabbco#766 introduced while merging 6cac870.
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneia committed Jun 10, 2016
1 parent 30fcbcb commit 90fc893
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/core/app.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,21 @@ end
function with_restart (app, method)
local oldshm = shm.path
shm.path = app.shmpath
local status, result
if use_restart then
-- Run fn in protected mode using pcall.
local status, result_or_error = pcall(method, app)
status, result = pcall(method, app)

-- If pcall caught an error mark app as "dead" (record time and cause
-- of death).
if not status then
app.dead = { error = result_or_error, time = now() }
app.dead = { error = result, time = now() }
end
return status, result_or_error
else
return true, method(app)
status, result = true, method(app)
end
shm.path = oldshm
return status, result_or_error
end

-- Restart dead apps.
Expand Down

0 comments on commit 90fc893

Please sign in to comment.