From 50f5ce660fa2898685c365344321fcadaeeab717 Mon Sep 17 00:00:00 2001 From: William Boman Date: Mon, 11 Apr 2022 14:48:04 +0200 Subject: fix(spawn): fix Failure.tostring when unable to retrieve uv_handle --- lua/nvim-lsp-installer/core/spawn.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/nvim-lsp-installer/core/spawn.lua b/lua/nvim-lsp-installer/core/spawn.lua index 4776ff66..8ac06aa4 100644 --- a/lua/nvim-lsp-installer/core/spawn.lua +++ b/lua/nvim-lsp-installer/core/spawn.lua @@ -24,7 +24,11 @@ local spawn = { local function Failure(err, cmd) return Result.failure(setmetatable(err, { __tostring = function() - return ("spawn: %s failed with exit code %d"):format(cmd, err.exit_code) + if err.exit_code ~= nil then + return ("spawn: %s failed with exit code %d. %s"):format(cmd, err.exit_code, err.stderr or "") + else + return ("spawn: %s failed with no exit code. %s"):format(cmd, err.stderr or "") + end end, })) end -- cgit v1.2.3-70-g09d2