From ebdf23b9b180c7f162e3afb4a250c313ca2b7271 Mon Sep 17 00:00:00 2001 From: Andrew Kwon Date: Wed, 9 Feb 2022 09:46:26 -0800 Subject: [PATCH] Fix remote nvim socket retrieval on Arch Linux Resolves #59 --- lua/presence/init.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lua/presence/init.lua b/lua/presence/init.lua index 8bb5a1c..58edf3b 100644 --- a/lua/presence/init.lua +++ b/lua/presence/init.lua @@ -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)