diff options
| author | William Boman <william@redwill.se> | 2021-10-01 22:47:59 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-01 22:47:59 +0200 |
| commit | 8212fc21b6a3c0000b1a5fb4c056c189c6fca212 (patch) | |
| tree | 227a5b8291b6f22184ab4bcf5e18448802c6d296 /lua/nvim-lsp-installer/server.lua | |
| parent | stylua and some cleanup (diff) | |
| download | mason-8212fc21b6a3c0000b1a5fb4c056c189c6fca212.tar mason-8212fc21b6a3c0000b1a5fb4c056c189c6fca212.tar.gz mason-8212fc21b6a3c0000b1a5fb4c056c189c6fca212.tar.bz2 mason-8212fc21b6a3c0000b1a5fb4c056c189c6fca212.tar.lz mason-8212fc21b6a3c0000b1a5fb4c056c189c6fca212.tar.xz mason-8212fc21b6a3c0000b1a5fb4c056c189c6fca212.tar.zst mason-8212fc21b6a3c0000b1a5fb4c056c189c6fca212.zip | |
fix newlines in stdout/stderr calls, more robust error handling (#114)
Diffstat (limited to 'lua/nvim-lsp-installer/server.lua')
| -rw-r--r-- | lua/nvim-lsp-installer/server.lua | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lua/nvim-lsp-installer/server.lua b/lua/nvim-lsp-installer/server.lua index a6299136..4c9bef52 100644 --- a/lua/nvim-lsp-installer/server.lua +++ b/lua/nvim-lsp-installer/server.lua @@ -79,8 +79,15 @@ function M.Server:install() end function M.Server:install_attached(context, callback) - self:uninstall() + local uninstall_ok, uninstall_err = pcall(self.uninstall, self) + if not uninstall_ok then + context.stdio_sink.stderr(tostring(uninstall_err) .. "\n") + callback(false) + return + end + self:create_root_dir() + local install_ok, install_err = pcall(self._installer, self, function(success) if not success then vim.schedule(function() @@ -94,7 +101,7 @@ function M.Server:install_attached(context, callback) callback(success) end, context) if not install_ok then - context.stdio_sink.stderr(tostring(install_err)) + context.stdio_sink.stderr(tostring(install_err) .. "\n") callback(false) end end |
