From 621c8c6d484ed402eab0d5e44c608d4296562a96 Mon Sep 17 00:00:00 2001 From: William Boman Date: Thu, 26 May 2022 00:32:28 +0200 Subject: fix(spawn): don't check executable when spawning with custom PATH (#721) --- tests/core/spawn_spec.lua | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'tests/core/spawn_spec.lua') 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) -- cgit v1.2.3-70-g09d2