Skip to content

Commit

Permalink
fix: replace vim.system with vim.fn.system
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikaverpil committed Oct 3, 2024
1 parent 80edbd9 commit 437780f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lua/lint/linters/buf_api_linter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ local function descriptor_set_in()

-- build the descriptor file.
local buf_config_folderpath = vim.fn.fnamemodify(buf_config_filepath, ":h")
local buf_cmd = { "buf", "build", "-o", descriptor_filepath }
local buf_cmd_opts = { cwd = buf_config_folderpath }
local obj = vim.system(buf_cmd, buf_cmd_opts):wait()
if obj.code ~= 0 then
error("Command failed: " .. vim.inspect(buf_cmd) .. "\n" .. obj.stderr)
local buf_cmd = string.format(
"cd %s && buf build -o %s",
vim.fn.shellescape(buf_config_folderpath),
vim.fn.shellescape(descriptor_filepath)
)
local output = vim.fn.system(buf_cmd)
local exit_code = vim.v.shell_error

if exit_code ~= 0 then
error("Command failed: " .. buf_cmd .. "\n" .. output)
end

-- return the argument to be passed to the linter.
Expand Down

0 comments on commit 437780f

Please sign in to comment.