1
0
Fork 0
mirror of https://github.com/jiriks74/presence.nvim synced 2024-12-29 19:32:05 +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"]], [[grep --color=never "nvim.*/0"]],
}, "|") }, "|")
elseif self.os.name == "linux" then elseif self.os.name == "linux" then
if vim.fn.executable("netstat") == 1 then if vim.fn.executable("ss") == 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
-- Use `ss` if available -- Use `ss` if available
cmd = table.concat({ cmd = table.concat({
"ss -lx", "ss -lx",
@ -547,6 +536,17 @@ function Presence:get_nvim_socket_paths(on_done)
function parser.parse(data) function parser.parse(data)
return data:match("%s(/.-)%s") return data:match("%s(/.-)%s")
end 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 else
local warning_msg = "Unable to get nvim socket paths: `netstat` and `ss` commands unavailable" local warning_msg = "Unable to get nvim socket paths: `netstat` and `ss` commands unavailable"
self.log:warn(warning_msg) self.log:warn(warning_msg)