mirror of https://github.com/folke/lazy.nvim.git
fix: log errors in runner
This commit is contained in:
parent
63cf2a52bd
commit
7303017b6f
|
@ -1,5 +1,6 @@
|
||||||
local Task = require("lazy.manage.task")
|
local Task = require("lazy.manage.task")
|
||||||
local Config = require("lazy.core.config")
|
local Config = require("lazy.core.config")
|
||||||
|
local Util = require("lazy.util")
|
||||||
|
|
||||||
---@class RunnerOpts
|
---@class RunnerOpts
|
||||||
---@field pipeline (string|{[1]:string, [string]:any})[]
|
---@field pipeline (string|{[1]:string, [string]:any})[]
|
||||||
|
@ -44,6 +45,9 @@ function Runner:_resume(entry)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
local ok, status = coroutine.resume(entry.co)
|
local ok, status = coroutine.resume(entry.co)
|
||||||
|
if not ok then
|
||||||
|
Util.error("Could not resume a task\n" .. status)
|
||||||
|
end
|
||||||
entry.status = ok and status
|
entry.status = ok and status
|
||||||
return entry.status ~= nil
|
return entry.status ~= nil
|
||||||
end
|
end
|
||||||
|
@ -69,6 +73,8 @@ function Runner:start()
|
||||||
local ok, status = coroutine.resume(co, self, plugin)
|
local ok, status = coroutine.resume(co, self, plugin)
|
||||||
if ok then
|
if ok then
|
||||||
table.insert(self._running, { co = co, status = status })
|
table.insert(self._running, { co = co, status = status })
|
||||||
|
else
|
||||||
|
Util.error("Could not start tasks for " .. plugin.name .. "\n" .. status)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -106,17 +112,18 @@ function Runner:run_pipeline(plugin)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param plugin LazyPlugin
|
---@param plugin LazyPlugin
|
||||||
---@param task_type string
|
---@param task_name string
|
||||||
---@param task_opts? TaskOptions
|
---@param opts? TaskOptions
|
||||||
---@return LazyTask?
|
---@return LazyTask?
|
||||||
function Runner:queue(plugin, task_type, task_opts)
|
function Runner:queue(plugin, task_name, opts)
|
||||||
assert(self._running)
|
assert(self._running)
|
||||||
local def = vim.split(task_type, ".", { plain = true })
|
local def = vim.split(task_name, ".", { plain = true })
|
||||||
---@type LazyTaskDef
|
---@type LazyTaskDef
|
||||||
local task_def = require("lazy.manage.task." .. def[1])[def[2]]
|
local task_def = require("lazy.manage.task." .. def[1])[def[2]]
|
||||||
assert(task_def)
|
assert(task_def)
|
||||||
if not (task_def.skip and task_def.skip(plugin, task_opts)) then
|
opts = opts or {}
|
||||||
local task = Task.new(plugin, def[2], task_def.run, task_opts)
|
if not (task_def.skip and task_def.skip(plugin, opts)) then
|
||||||
|
local task = Task.new(plugin, def[2], task_def.run, opts)
|
||||||
task:start()
|
task:start()
|
||||||
return task
|
return task
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue