From 1c924d5a9ea3496c4e1a02d0d51388ba809f8468 Mon Sep 17 00:00:00 2001 From: Isard Date: Fri, 2 Aug 2024 22:57:29 +0100 Subject: [PATCH] fix: Make command execution on windows work for non-exe open methods (#141) This should make is so that using "start" as an open_program in the config actually works on windows. it changes the executable check out for an try-catch basically. --- lua/crates/util.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/crates/util.lua b/lua/crates/util.lua index a4c4868..0a2f2fe 100644 --- a/lua/crates/util.lua +++ b/lua/crates/util.lua @@ -234,8 +234,8 @@ end ---@param url string function M.open_url(url) for _, prg in ipairs(state.cfg.open_programs) do - if M.binary_installed(prg) then - vim.cmd(string.format("silent !%s %s", prg, url)) + local ok, result = pcall(vim.cmd, string.format("silent !%s %s", prg, url)) + if ok == true then return end end