fix(ci): format
This commit is contained in:
parent
b6f3398bbc
commit
c192afc5d7
1 changed files with 24 additions and 28 deletions
|
|
@ -42,36 +42,32 @@ local function run_scraper(platform, subcommand, args, opts)
|
||||||
local buf = ''
|
local buf = ''
|
||||||
|
|
||||||
local handle
|
local handle
|
||||||
handle = uv.spawn(
|
handle = uv.spawn(cmd[1], {
|
||||||
cmd[1],
|
args = vim.list_slice(cmd, 2),
|
||||||
{
|
stdio = { nil, stdout, stderr },
|
||||||
args = vim.list_slice(cmd, 2),
|
env = env,
|
||||||
stdio = { nil, stdout, stderr },
|
cwd = plugin_path,
|
||||||
env = env,
|
}, function(code, signal)
|
||||||
cwd = plugin_path,
|
if buf ~= '' and opts.on_event then
|
||||||
},
|
local ok_tail, ev_tail = pcall(vim.json.decode, buf)
|
||||||
function(code, signal)
|
if ok_tail then
|
||||||
if buf ~= '' and opts.on_event then
|
opts.on_event(ev_tail)
|
||||||
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
|
||||||
|
buf = ''
|
||||||
end
|
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
|
if not handle then
|
||||||
logger.log('Failed to start scraper process', vim.log.levels.ERROR)
|
logger.log('Failed to start scraper process', vim.log.levels.ERROR)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue