mirror of
https://github.com/jiriks74/presence.nvim
synced 2024-12-28 11:02:34 +01:00
parent
9aeb8e0cf3
commit
ebdf23b9b1
1 changed files with 12 additions and 12 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue