mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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).
This commit is contained in:
parent
794e7b4359
commit
4d10024a56
@ -23,7 +23,7 @@ local function _os_proc_info(pid)
|
|||||||
end
|
end
|
||||||
local _, ppid = _system({ 'ps', '-p', pid, '-o', 'ppid=', })
|
local _, ppid = _system({ 'ps', '-p', pid, '-o', 'ppid=', })
|
||||||
-- Remove trailing whitespace.
|
-- Remove trailing whitespace.
|
||||||
name = string.gsub(name, '%s+$', '')
|
name = string.gsub(string.gsub(name, '%s+$', ''), '^.*/', '')
|
||||||
ppid = string.gsub(ppid, '%s+$', '')
|
ppid = string.gsub(ppid, '%s+$', '')
|
||||||
ppid = tonumber(ppid) == nil and -1 or tonumber(ppid)
|
ppid = tonumber(ppid) == nil and -1 or tonumber(ppid)
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user