aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Hinz <mh.codebro+github@gmail.com>2018-02-01 13:14:29 +0100
committerGitHub <noreply@github.com>2018-02-01 13:14:29 +0100
commit6710164c2c44335a916a728cc8eb329c69d155f4 (patch)
tree2068621036ead85f9eac071f272ea863d5b44d3e
parentf8010ea3eca77961312afeb96234678447ce17e4 (diff)
downloadrneovim-6710164c2c44335a916a728cc8eb329c69d155f4.tar.gz
rneovim-6710164c2c44335a916a728cc8eb329c69d155f4.tar.bz2
rneovim-6710164c2c44335a916a728cc8eb329c69d155f4.zip
provider: make has('ruby') only return 1 if gem is installed (#7944)
-rw-r--r--src/nvim/eval.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 67538c248e..1d483eee18 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -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;
}