Skip to content

Commit 814a927

Browse files
authored
perf(build): async run to avoid blocking (#46)
1 parent d851155 commit 814a927

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lua/colorbox.lua

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,9 @@ local function update()
295295
vim.inspect(data)
296296
)
297297
local lines = {}
298-
for _, line in ipairs(data) do
299-
if string.len(vim.trim(line)) > 0 then
300-
table.insert(lines, line)
298+
for _, d in ipairs(data) do
299+
if type(d) == "string" and string.len(vim.trim(d)) > 0 then
300+
table.insert(lines, d)
301301
end
302302
end
303303
if #lines > 0 then
@@ -323,6 +323,7 @@ local function update()
323323
logger.debug("update command:%s", vim.inspect(cmd))
324324
local jobid = vim.fn.jobstart(cmd, {
325325
cwd = spec.full_pack_path,
326+
detach = true,
326327
stdout_buffered = true,
327328
stderr_buffered = true,
328329
on_stdout = _on_output,
@@ -336,18 +337,16 @@ local function update()
336337
logger.debug("install command:%s", vim.inspect(cmd))
337338
local jobid = vim.fn.jobstart(cmd, {
338339
cwd = home_dir,
340+
detach = true,
339341
stdout_buffered = true,
340342
stderr_buffered = true,
341343
on_stdout = _on_output,
342344
on_stderr = _on_output,
343345
on_exit = _on_exit,
344346
})
345-
logger.debug("installing %s", vim.inspect(handle))
346347
table.insert(jobs, jobid)
347348
end
348349
end
349-
vim.fn.jobwait(jobs)
350-
logger.close_file_mode_w()
351350
end
352351

353352
local M = { setup = setup, update = update }

0 commit comments

Comments
 (0)