1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 10:40:03 +08:00

fix(python): add debug info for Shebang_to_cmd

This commit is contained in:
Eric Wong 2024-06-13 22:35:39 +08:00
parent f818591314
commit 0fccfab12d

View File

@ -282,6 +282,9 @@ endfunction
function! s:Shebang_to_cmd(line) abort
let executable = matchstr(a:line, '#!\s*\zs[^ ]*')
if empty(executable)
return []
endif
let argvs = split(matchstr(a:line, '#!\s*[^ ]\+\s*\zs.*'))
return [executable] + argvs
endfunction
@ -289,7 +292,14 @@ endfunction
func! s:getexe() abort
let line = getline(1)
if line =~# '^#!'
return s:Shebang_to_cmd(line)
let cmd = s:Shebang_to_cmd(line)
if empty(cmd)
call SpaceVim#logger#debug('failed to parse shebang')
elseif !executable(cmd[0])
call SpaceVim#logger#debug('shebang is not executable')
else
return cmd
endif
endif
return [s:python_interpreter]
endf