1
0
Fork 0
mirror of https://github.com/jiriks74/presence.nvim synced 2024-12-28 11:02:34 +01:00

Fix remote nvim socket retrieval on Arch Linux

Resolves #59
This commit is contained in:
Andrew Kwon 2022-02-09 09:46:26 -08:00
parent 9aeb8e0cf3
commit ebdf23b9b1

View file

@ -525,18 +525,7 @@ function Presence:get_nvim_socket_paths(on_done)
[[grep --color=never "nvim.*/0"]],
}, "|")
elseif self.os.name == "linux" then
if vim.fn.executable("netstat") == 1 then
-- Use `netstat` if available
cmd = table.concat({
"netstat -u",
[[grep --color=never "nvim.*/0"]],
}, "|")
-- Define netstat output parser
function parser.parse(data)
return data:match("%s(/.+)")
end
elseif vim.fn.executable("ss") == 1 then
if vim.fn.executable("ss") == 1 then
-- Use `ss` if available
cmd = table.concat({
"ss -lx",
@ -547,6 +536,17 @@ function Presence:get_nvim_socket_paths(on_done)
function parser.parse(data)
return data:match("%s(/.-)%s")
end
elseif vim.fn.executable("netstat") == 1 then
-- Use `netstat` if available
cmd = table.concat({
"netstat -u",
[[grep --color=never "nvim.*/0"]],
}, "|")
-- Define netstat output parser
function parser.parse(data)
return data:match("%s(/.+)")
end
else
local warning_msg = "Unable to get nvim socket paths: `netstat` and `ss` commands unavailable"
self.log:warn(warning_msg)