aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lua/nvim-lsp-installer/core/spawn.lua2
-rw-r--r--lua/nvim-lsp-installer/core/ui/display.lua2
-rw-r--r--tests/core/spawn_spec.lua29
3 files changed, 30 insertions, 3 deletions
diff --git a/lua/nvim-lsp-installer/core/spawn.lua b/lua/nvim-lsp-installer/core/spawn.lua
index a1c55c0f..764468f9 100644
--- a/lua/nvim-lsp-installer/core/spawn.lua
+++ b/lua/nvim-lsp-installer/core/spawn.lua
@@ -85,7 +85,7 @@ setmetatable(spawn, {
local cmd = self._aliases[normalized_cmd] or normalized_cmd
- if args.check_executable ~= false and not is_executable(cmd) then
+ if args.with_paths == nil and args.check_executable ~= false and not is_executable(cmd) then
return Failure({
stderr = ("%s is not executable"):format(cmd),
}, cmd)
diff --git a/lua/nvim-lsp-installer/core/ui/display.lua b/lua/nvim-lsp-installer/core/ui/display.lua
index c80738cd..df12eade 100644
--- a/lua/nvim-lsp-installer/core/ui/display.lua
+++ b/lua/nvim-lsp-installer/core/ui/display.lua
@@ -317,7 +317,7 @@ function M.new_view_only_win(name)
bufhidden = "wipe",
buflisted = false,
filetype = "lsp-installer",
- undolevels = -1
+ undolevels = -1,
}
local win_opts = {
diff --git a/tests/core/spawn_spec.lua b/tests/core/spawn_spec.lua
index 73bcdf28..ce6e4684 100644
--- a/tests/core/spawn_spec.lua
+++ b/tests/core/spawn_spec.lua
@@ -181,9 +181,36 @@ describe("async spawn", function()
callback(false, 127)
end)
- local result = spawn.my_cmd { check_executable = false }
+ local result = spawn.my_cmd { "arg1", check_executable = false }
assert.is_true(result:is_failure())
assert.spy(process.spawn).was_called(1)
+ assert.spy(process.spawn).was_called_with(
+ "my_cmd",
+ match.tbl_containing {
+ args = match.same { "arg1" },
+ },
+ match.is_function()
+ )
+ end)
+ )
+
+ it(
+ "should skip checking whether command is executable if with_paths is provided",
+ async_test(function()
+ stub(process, "spawn", function(_, _, callback)
+ callback(false, 127)
+ end)
+
+ local result = spawn.my_cmd { "arg1", with_paths = {} }
+ assert.is_true(result:is_failure())
+ assert.spy(process.spawn).was_called(1)
+ assert.spy(process.spawn).was_called_with(
+ "my_cmd",
+ match.tbl_containing {
+ args = match.same { "arg1" },
+ },
+ match.is_function()
+ )
end)
)
end)