aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/process.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2021-10-05 14:38:00 +0200
committerWilliam Boman <william@redwill.se>2021-10-05 14:38:00 +0200
commitd00fbe2058dbd175d2ff8d6f78b6f099a0fbdbd1 (patch)
treee31d1752db95099853bc18fee1d85ebf15f83a1e /lua/nvim-lsp-installer/process.lua
parentREADME: update recording (diff)
downloadmason-d00fbe2058dbd175d2ff8d6f78b6f099a0fbdbd1.tar
mason-d00fbe2058dbd175d2ff8d6f78b6f099a0fbdbd1.tar.gz
mason-d00fbe2058dbd175d2ff8d6f78b6f099a0fbdbd1.tar.bz2
mason-d00fbe2058dbd175d2ff8d6f78b6f099a0fbdbd1.tar.lz
mason-d00fbe2058dbd175d2ff8d6f78b6f099a0fbdbd1.tar.xz
mason-d00fbe2058dbd175d2ff8d6f78b6f099a0fbdbd1.tar.zst
mason-d00fbe2058dbd175d2ff8d6f78b6f099a0fbdbd1.zip
better error messaging
Diffstat (limited to 'lua/nvim-lsp-installer/process.lua')
-rw-r--r--lua/nvim-lsp-installer/process.lua14
1 files changed, 9 insertions, 5 deletions
diff --git a/lua/nvim-lsp-installer/process.lua b/lua/nvim-lsp-installer/process.lua
index bb40b25b..dca7b328 100644
--- a/lua/nvim-lsp-installer/process.lua
+++ b/lua/nvim-lsp-installer/process.lua
@@ -95,8 +95,8 @@ function M.spawn(cmd, opts, callback)
}
end)
- local handle, pid
- handle, pid = uv.spawn(cmd, spawn_opts, function(exit_code, signal)
+ local handle, pid_or_err
+ handle, pid_or_err = uv.spawn(cmd, spawn_opts, function(exit_code, signal)
local successful = exit_code == 0 and signal == 0
handle:close()
if not stdin:is_closing() then
@@ -118,13 +118,17 @@ function M.spawn(cmd, opts, callback)
end)
if handle == nil then
- log.error("Failed to spawn process", cmd, pid)
- opts.stdio_sink.stderr(("Failed to spawn process cmd=%s pid=%s\n"):format(cmd, pid))
+ log.fmt_error("Failed to spawn process. cmd=%s, err=%s", cmd, pid_or_err)
+ if type(pid_or_err) == "string" and pid_or_err:find "ENOENT" == 1 then
+ opts.stdio_sink.stderr(("Could not find required executable %q in path.\n"):format(cmd))
+ else
+ opts.stdio_sink.stderr(("Failed to spawn process cmd=%s err=%s\n"):format(cmd, pid_or_err))
+ end
callback(false)
return nil, nil
end
- log.debug("Spawned with pid", pid)
+ log.debug("Spawned with pid", pid_or_err)
stdout:read_start(connect_sink(stdout, opts.stdio_sink.stdout))
stderr:read_start(connect_sink(stderr, opts.stdio_sink.stderr))