Skip to content

Commit

Permalink
fix: make sure we have ran on_exit before returning is_done=true
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Nov 29, 2022
1 parent 5d84967 commit 782d287
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions lua/lazy/manage/task/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,7 @@ function Task:is_done()
end

function Task:is_running()
for _, state in ipairs(self._running) do
if state() then
return true
end
end
return false
return self:has_started() and self._ended == nil
end

function Task:start()
Expand All @@ -78,8 +73,10 @@ end

---@private
function Task:_check()
if self:is_running() then
return
for _, state in ipairs(self._running) do
if state() then
return
end
end
self._ended = vim.loop.hrtime()
if self._opts.on_done then
Expand Down

0 comments on commit 782d287

Please sign in to comment.