From c192afc5d7d8ae4b852471432be02390b955d874 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Wed, 18 Feb 2026 14:09:18 -0500 Subject: [PATCH] fix(ci): format --- lua/cp/scraper.lua | 52 +++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/lua/cp/scraper.lua b/lua/cp/scraper.lua index 10fc7b7..d64a765 100644 --- a/lua/cp/scraper.lua +++ b/lua/cp/scraper.lua @@ -42,36 +42,32 @@ local function run_scraper(platform, subcommand, args, opts) local buf = '' local handle - handle = uv.spawn( - cmd[1], - { - args = vim.list_slice(cmd, 2), - stdio = { nil, stdout, stderr }, - env = env, - cwd = plugin_path, - }, - function(code, signal) - if buf ~= '' and opts.on_event then - local ok_tail, ev_tail = pcall(vim.json.decode, buf) - if ok_tail then - opts.on_event(ev_tail) - end - buf = '' - end - if opts.on_exit then - opts.on_exit({ success = (code == 0), code = code, signal = signal }) - end - if not stdout:is_closing() then - stdout:close() - end - if not stderr:is_closing() then - stderr:close() - end - if handle and not handle:is_closing() then - handle:close() + handle = uv.spawn(cmd[1], { + args = vim.list_slice(cmd, 2), + stdio = { nil, stdout, stderr }, + env = env, + cwd = plugin_path, + }, function(code, signal) + if buf ~= '' and opts.on_event then + local ok_tail, ev_tail = pcall(vim.json.decode, buf) + if ok_tail then + opts.on_event(ev_tail) end + buf = '' end - ) + if opts.on_exit then + opts.on_exit({ success = (code == 0), code = code, signal = signal }) + end + if not stdout:is_closing() then + stdout:close() + end + if not stderr:is_closing() then + stderr:close() + end + if handle and not handle:is_closing() then + handle:close() + end + end) if not handle then logger.log('Failed to start scraper process', vim.log.levels.ERROR)