From 47f2769b462eb6bd1c10efec3c32ed55134ce628 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Fri, 13 Dec 2024 14:22:59 +0000 Subject: fix(Man): completion on Mac Problem: `man -w` does not work on recent versions of MacOs. Solution: Make it so an empty result is interpreted as an error unless silent=true --- runtime/lua/man.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'runtime/lua') diff --git a/runtime/lua/man.lua b/runtime/lua/man.lua index 114c94f9e5..bf2cc477fd 100644 --- a/runtime/lua/man.lua +++ b/runtime/lua/man.lua @@ -21,9 +21,12 @@ end local function system(cmd, silent, env) local r = vim.system(cmd, { env = env, timeout = 10000 }):wait() - if r.code ~= 0 and not silent then - local cmd_str = table.concat(cmd, ' ') - man_error(string.format("command error '%s': %s", cmd_str, r.stderr)) + if not silent then + if r.code ~= 0 then + local cmd_str = table.concat(cmd, ' ') + man_error(string.format("command error '%s': %s", cmd_str, r.stderr)) + end + assert(r.stdout ~= '') end return assert(r.stdout) -- cgit