Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

executable()

os_can_exe() used by executable() actually checks PATHEXT. Behaviour in Vim is:

executable('no_such_file') returns 0
executable('file') returns 1 if file.bat,file.exe,etc exist ($PATHEXT)
executable('file.bat')returns 1
executable('file.exe')returns 1

This could lead to the misconception that, for example, executable("file.bat") being 1 implies that system(["file.bat"]) is expected to succeed, which is not true. But this is an issue with system([]) in windows and not with executable(). The notion of executable in Windows is fundamentaly a shell concept, because unlike UNIX there no notion of shebang and permission bits, that allows execution of non binary files.

$PATHEXT

The original behaviour in Vim and I believe its still the case in Neovim, is that if $PATHEXT is missing a default of .com;.exe;.bat;.cmd is used.

@justinmk

This comment has been minimized.

Copy link

@justinmk justinmk commented Feb 1, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment