diff options
| author | William Boman <william@redwill.se> | 2021-09-01 10:29:23 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-01 10:29:23 +0200 |
| commit | bfbf5fbd39fa75847bf23da2c46d12fe2728fb78 (patch) | |
| tree | f05d2f041f895ff639684c10f57d19f1d4a433e0 /lua/nvim-lsp-installer/installers/zx.lua | |
| parent | README: simplify example a bit, add clarifying comment (diff) | |
| download | mason-bfbf5fbd39fa75847bf23da2c46d12fe2728fb78.tar mason-bfbf5fbd39fa75847bf23da2c46d12fe2728fb78.tar.gz mason-bfbf5fbd39fa75847bf23da2c46d12fe2728fb78.tar.bz2 mason-bfbf5fbd39fa75847bf23da2c46d12fe2728fb78.tar.lz mason-bfbf5fbd39fa75847bf23da2c46d12fe2728fb78.tar.xz mason-bfbf5fbd39fa75847bf23da2c46d12fe2728fb78.tar.zst mason-bfbf5fbd39fa75847bf23da2c46d12fe2728fb78.zip | |
add Windows support (#70)
Diffstat (limited to 'lua/nvim-lsp-installer/installers/zx.lua')
| -rw-r--r-- | lua/nvim-lsp-installer/installers/zx.lua | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lua/nvim-lsp-installer/installers/zx.lua b/lua/nvim-lsp-installer/installers/zx.lua index 5308ac66..b713b4ec 100644 --- a/lua/nvim-lsp-installer/installers/zx.lua +++ b/lua/nvim-lsp-installer/installers/zx.lua @@ -2,6 +2,7 @@ local fs = require "nvim-lsp-installer.fs" local path = require "nvim-lsp-installer.path" local notify = require "nvim-lsp-installer.notify" local installers = require "nvim-lsp-installer.installers" +local platform = require "nvim-lsp-installer.platform" local shell = require "nvim-lsp-installer.installers.shell" local npm = require "nvim-lsp-installer.installers.npm" @@ -37,8 +38,8 @@ local function zx_installer(force) fs.mkdirp(INSTALL_DIR) - uv.spawn( - "npm", + local handle, pid = uv.spawn( + platform.is_win() and "npm.cmd" or "npm", { args = { npm_command, "zx@1" }, cwd = INSTALL_DIR, @@ -53,13 +54,17 @@ local function zx_installer(force) callback(true, nil) end) ) + + if handle == nil then + callback(false, ("Failed to install/update zx. %s"):format(pid)) + end end end function M.file(relpath) local script_path = path.realpath(relpath, 3) return installers.compose { - shell.raw(("%q %q"):format(ZX_EXECUTABLE, script_path)), + shell.polyshell(("%q %q"):format(ZX_EXECUTABLE, ("file:///%s"):format(script_path))), zx_installer(false), } end |
