Skip to content

Commit 437780f

Browse files
fix: replace vim.system with vim.fn.system
1 parent 80edbd9 commit 437780f

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lua/lint/linters/buf_api_linter.lua

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,16 @@ local function descriptor_set_in()
3333

3434
-- build the descriptor file.
3535
local buf_config_folderpath = vim.fn.fnamemodify(buf_config_filepath, ":h")
36-
local buf_cmd = { "buf", "build", "-o", descriptor_filepath }
37-
local buf_cmd_opts = { cwd = buf_config_folderpath }
38-
local obj = vim.system(buf_cmd, buf_cmd_opts):wait()
39-
if obj.code ~= 0 then
40-
error("Command failed: " .. vim.inspect(buf_cmd) .. "\n" .. obj.stderr)
36+
local buf_cmd = string.format(
37+
"cd %s && buf build -o %s",
38+
vim.fn.shellescape(buf_config_folderpath),
39+
vim.fn.shellescape(descriptor_filepath)
40+
)
41+
local output = vim.fn.system(buf_cmd)
42+
local exit_code = vim.v.shell_error
43+
44+
if exit_code ~= 0 then
45+
error("Command failed: " .. buf_cmd .. "\n" .. output)
4146
end
4247

4348
-- return the argument to be passed to the linter.

0 commit comments

Comments
 (0)