From 26d937f53d9566a401797e3a50a946f42c4b500c Mon Sep 17 00:00:00 2001 From: Muhammad Imaduddin Date: Sat, 17 Aug 2024 16:43:40 +0700 Subject: [PATCH] fix!: broken 'go list' report on some systems (#167) --- lua/neotest-golang/lib/cmd.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lua/neotest-golang/lib/cmd.lua b/lua/neotest-golang/lib/cmd.lua index db8396d7..dd9eefaf 100644 --- a/lua/neotest-golang/lib/cmd.lua +++ b/lua/neotest-golang/lib/cmd.lua @@ -18,9 +18,12 @@ function M.golist_data(cwd) } local go_list_command_concat = table.concat(go_list_command, " ") logger.debug("Running Go list: " .. go_list_command_concat .. " in " .. cwd) - local output = - vim.fn.system("cd " .. cwd .. " && " .. go_list_command_concat, " ") - logger.info({ "Go list output: ", output }) + local output = vim + .system(go_list_command, { cwd = cwd, text = true }) + :wait().stdout or "" + if output == "" then + logger.error({ "Execution of 'go list' failed, output:", output }) + end return json.decode_from_string(output) end