From 0e90f04651388df2477400b4b63e5443fcda43af Mon Sep 17 00:00:00 2001 From: William Boman Date: Tue, 17 May 2022 23:15:36 +0200 Subject: fix(spawn): avoid spawning commands that aren't on PATH (#706) This is primarily done to avoid cluttering the log file with a bunch of ERROR entries. Also avoids unnecessary roundtrips to uv_spawn, I guess. --- tests/core/spawn_spec.lua | 14 +++++++++++++- 1 file changed, 13 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 b3dfce35..c7b4f320 100644 --- a/tests/core/spawn_spec.lua +++ b/tests/core/spawn_spec.lua @@ -153,10 +153,22 @@ describe("async spawn", function() callback(false, 127) end) + local result = spawn.bash {} + assert.is_true(result:is_failure()) + assert.equals( + "spawn: bash failed with exit code 127. This is an error message for bash!", + tostring(result:err_or_nil()) + ) + end) + ) + + it( + "should skip checking executable", + async_test(function() local result = spawn.my_cmd {} assert.is_true(result:is_failure()) assert.equals( - "spawn: my_cmd failed with exit code 127. This is an error message for my_cmd!", + "spawn: my_cmd failed with no exit code. my_cmd is not executable", tostring(result:err_or_nil()) ) end) -- cgit v1.2.3-70-g09d2