Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mike325 committed Nov 7, 2024
1 parent 666c87e commit 80cb4bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
13 changes: 4 additions & 9 deletions lua/utils/files.lua
Original file line number Diff line number Diff line change
Expand Up @@ -864,18 +864,13 @@ function M.dump_json(filename, data)

local json = M.encode_json(data)
if M.executable 'jq' then
local on_exit = function(obj)
if obj.code == 0 then
M.writefile(filename, obj.stdout, true)
else
M.writefile(filename, json)
end
local job = vim.system({ 'jq', '.' }, { text = true, stdin = json }):wait()
if job.code == 0 then
return M.writefile(filename, job.stdout)
end
vim.system({ 'jq', '.' }, { text = true, stdin = json }, on_exit)
return
end

M.writefile(filename, json)
return M.writefile(filename, json)
end

-- NOTE: dir/parents where took from neovim fs.lua source code
Expand Down
1 change: 1 addition & 0 deletions tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ if ! hash nvim 2>/dev/null; then
fi

locations=(
'deps'
'packer'
'host'
)
Expand Down

0 comments on commit 80cb4bb

Please sign in to comment.