Skip to content

Commit 94bb7b7

Browse files
committed
check if executable is available
1 parent 95c13f5 commit 94bb7b7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lua/custom-autocmd.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,11 @@ api.nvim_create_autocmd("BufWritePost", {
267267
local cmd = vim.deepcopy(ft_to_command[ft])
268268
table.insert(cmd, fpath)
269269

270+
local exe_path = cmd[1]
271+
if not utils.executable(exe_path) then
272+
return
273+
end
274+
270275
local result = vim.system(cmd, { text = true }):wait()
271276

272277
if result.code ~= 0 then

0 commit comments

Comments
 (0)