mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
provider: make has('ruby') only return 1 if gem is installed (#7944)
This commit is contained in:
parent
f8010ea3ec
commit
6710164c2c
@ -1279,7 +1279,7 @@ varnumber_T call_func_retnr(char_u *func, int argc,
|
||||
char *call_func_retstr(const char *const func, const int argc,
|
||||
const char_u *const *const argv,
|
||||
const bool safe)
|
||||
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_MALLOC
|
||||
FUNC_ATTR_NONNULL_ARG(1) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_MALLOC
|
||||
{
|
||||
typval_T rettv;
|
||||
// All arguments are passed as strings, no conversion to number.
|
||||
@ -10733,6 +10733,17 @@ static void f_has(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
n = true;
|
||||
}
|
||||
|
||||
if (STRICMP(name, "ruby") == 0 && n == true) {
|
||||
char *rubyhost = call_func_retstr("provider#ruby#Detect", 0, NULL, true);
|
||||
if (rubyhost) {
|
||||
if (*rubyhost == NUL) {
|
||||
// Invalid rubyhost executable. Gem is probably not installed.
|
||||
n = false;
|
||||
}
|
||||
xfree(rubyhost);
|
||||
}
|
||||
}
|
||||
|
||||
rettv->vval.v_number = n;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user