mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-23 01:09:56 +08:00
fix(job): check cmd before run job
This commit is contained in:
parent
ccfc031441
commit
7ff2fec04a
@ -79,6 +79,9 @@ function M.start(cmd, opts)
|
|||||||
local command = ''
|
local command = ''
|
||||||
local argv = {}
|
local argv = {}
|
||||||
if type(cmd) == 'string' then
|
if type(cmd) == 'string' then
|
||||||
|
if cmd == '' then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
local shell = vim.fn.split(vim.o.shell)
|
local shell = vim.fn.split(vim.o.shell)
|
||||||
local shellcmdflag = vim.fn.split(vim.o.shellcmdflag)
|
local shellcmdflag = vim.fn.split(vim.o.shellcmdflag)
|
||||||
-- :call jobstart(split(&shell) + split(&shellcmdflag) + ['{cmd}'])
|
-- :call jobstart(split(&shell) + split(&shellcmdflag) + ['{cmd}'])
|
||||||
@ -89,7 +92,15 @@ function M.start(cmd, opts)
|
|||||||
end
|
end
|
||||||
table.insert(argv, cmd)
|
table.insert(argv, cmd)
|
||||||
elseif type(cmd) == 'table' then
|
elseif type(cmd) == 'table' then
|
||||||
|
for _, v in ipairs(cmd) do
|
||||||
|
if type(v) ~= 'string' then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
end
|
||||||
command = cmd[1]
|
command = cmd[1]
|
||||||
|
if command == '' then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
if vim.fn.executable(command) == 0 then
|
if vim.fn.executable(command) == 0 then
|
||||||
return -1
|
return -1
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user