From 4d10024a561a20cb2291f5615e4b01957dd955b9 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Sat, 18 Aug 2018 14:37:29 +0200 Subject: API: Remove path prefix from command name in nvim_get_proc() On macOS the output from `ps -o comm` might contain the full path of the executable. The `ucomm` would be the basename only but is less portable (see previous commit). --- src/nvim/lua/vim.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/lua/vim.lua') diff --git a/src/nvim/lua/vim.lua b/src/nvim/lua/vim.lua index 6900313752..47f40da72e 100644 --- a/src/nvim/lua/vim.lua +++ b/src/nvim/lua/vim.lua @@ -23,7 +23,7 @@ local function _os_proc_info(pid) end local _, ppid = _system({ 'ps', '-p', pid, '-o', 'ppid=', }) -- Remove trailing whitespace. - name = string.gsub(name, '%s+$', '') + name = string.gsub(string.gsub(name, '%s+$', ''), '^.*/', '') ppid = string.gsub(ppid, '%s+$', '') ppid = tonumber(ppid) == nil and -1 or tonumber(ppid) return { -- cgit