fix: use jobstart instead of system to open urls

This commit is contained in:
Folke Lemaitre 2022-12-20 12:34:24 +01:00
parent 5ecc988610
commit 1754056475
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 4 additions and 3 deletions

View File

@ -11,15 +11,16 @@ function M.open(uri)
end
local cmd
if vim.fn.has("win32") == 1 then
cmd = { "cmd.exe", "/c", "start", '""', vim.fn.shellescape(uri) }
cmd = { "explorer", uri }
-- cmd = { 'cmd.exe', '/c', 'start', '""', uri }
elseif vim.fn.has("macunix") == 1 then
cmd = { "open", uri }
else
cmd = { "xdg-open", uri }
end
local ret = vim.fn.system(cmd)
if vim.v.shell_error ~= 0 then
local ret = vim.fn.jobstart(cmd, { detach = true })
if ret <= 0 then
local msg = {
"Failed to open uri",
ret,