aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/eval.c21
-rw-r--r--src/nvim/globals.h1
-rw-r--r--src/nvim/po/af.po5
-rw-r--r--src/nvim/po/ca.po5
-rw-r--r--src/nvim/po/cs.cp1250.po5
-rw-r--r--src/nvim/po/cs.po5
-rw-r--r--src/nvim/po/de.po5
-rw-r--r--src/nvim/po/en_GB.po5
-rw-r--r--src/nvim/po/eo.po5
-rw-r--r--src/nvim/po/es.po5
-rw-r--r--src/nvim/po/fi.po5
-rw-r--r--src/nvim/po/fr.po5
-rw-r--r--src/nvim/po/ga.po5
-rw-r--r--src/nvim/po/it.po5
-rw-r--r--src/nvim/po/ja.euc-jp.po5
-rw-r--r--src/nvim/po/ja.po5
-rw-r--r--src/nvim/po/ko.UTF-8.po5
-rw-r--r--src/nvim/po/nb.po5
-rw-r--r--src/nvim/po/nl.po5
-rw-r--r--src/nvim/po/no.po5
-rw-r--r--src/nvim/po/pl.UTF-8.po5
-rw-r--r--src/nvim/po/pt_BR.po5
-rw-r--r--src/nvim/po/ru.po5
-rw-r--r--src/nvim/po/sk.cp1250.po5
-rw-r--r--src/nvim/po/sk.po5
-rw-r--r--src/nvim/po/sv.po5
-rw-r--r--src/nvim/po/uk.po4
-rw-r--r--src/nvim/po/vi.po5
-rw-r--r--src/nvim/po/zh_CN.UTF-8.po5
-rw-r--r--src/nvim/po/zh_TW.UTF-8.po5
-rw-r--r--test/functional/core/job_spec.lua19
-rw-r--r--test/functional/fixtures/non_executable.txt1
32 files changed, 29 insertions, 152 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index ba5864fe3b..a02ca40173 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -11581,7 +11581,7 @@ static void f_jobresize(typval_T *argvars, typval_T *rettv, FunPtr fptr)
rettv->vval.v_number = 1;
}
-static char **tv_to_argv(typval_T *cmd_tv, char **cmd)
+static char **tv_to_argv(typval_T *cmd_tv, char **cmd, bool *executable)
{
if (cmd_tv->v_type == VAR_STRING) {
char *cmd_str = (char *)get_tv_string(cmd_tv);
@@ -11599,7 +11599,7 @@ static char **tv_to_argv(typval_T *cmd_tv, char **cmd)
list_T *argl = cmd_tv->vval.v_list;
int argc = argl->lv_len;
if (!argc) {
- EMSG(_("Argument vector must have at least one item"));
+ EMSG(_(e_invarg)); // List must have at least one item.
return NULL;
}
@@ -11607,9 +11607,8 @@ static char **tv_to_argv(typval_T *cmd_tv, char **cmd)
const char_u *exe = get_tv_string_chk(&argl->lv_first->li_tv);
if (!exe || !os_can_exe(exe, NULL, true)) {
- // String is not executable
- if (exe) {
- EMSG2(e_jobexe, exe);
+ if (exe && executable) {
+ *executable = false;
}
return NULL;
}
@@ -11617,7 +11616,7 @@ static char **tv_to_argv(typval_T *cmd_tv, char **cmd)
if (cmd) {
*cmd = (char *)exe;
}
-
+
// Build the argument vector
int i = 0;
char **argv = xcalloc(argc + 1, sizeof(char *));
@@ -11644,8 +11643,10 @@ static void f_jobstart(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return;
}
- char **argv = tv_to_argv(&argvars[0], NULL);
+ bool executable = true;
+ char **argv = tv_to_argv(&argvars[0], NULL, &executable);
if (!argv) {
+ rettv->vval.v_number = executable ? 0 : -1;
return; // Did error message in tv_to_argv.
}
@@ -16235,7 +16236,7 @@ static void get_system_output_as_rettv(typval_T *argvars, typval_T *rettv,
}
// get shell command to execute
- char **argv = tv_to_argv(&argvars[0], NULL);
+ char **argv = tv_to_argv(&argvars[0], NULL, NULL);
if (!argv) {
xfree(input);
return; // Already did emsg.
@@ -16468,8 +16469,10 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
char *cmd;
- char **argv = tv_to_argv(&argvars[0], &cmd);
+ bool executable = true;
+ char **argv = tv_to_argv(&argvars[0], &cmd, &executable);
if (!argv) {
+ rettv->vval.v_number = executable ? 0 : -1;
return; // Did error message in tv_to_argv.
}
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index f81fb43eaf..acdda9b657 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -1125,7 +1125,6 @@ EXTERN char_u e_invcmd[] INIT(= N_("E476: Invalid command"));
EXTERN char_u e_isadir2[] INIT(= N_("E17: \"%s\" is a directory"));
EXTERN char_u e_invjob[] INIT(= N_("E900: Invalid job id"));
EXTERN char_u e_jobtblfull[] INIT(= N_("E901: Job table is full"));
-EXTERN char_u e_jobexe[] INIT(= N_("E902: \"%s\" is not an executable"));
EXTERN char_u e_jobspawn[] INIT(= N_(
"E903: Process for command \"%s\" could not be spawned"));
EXTERN char_u e_jobnotpty[] INIT(= N_("E904: Job is not connected to a pty"));
diff --git a/src/nvim/po/af.po b/src/nvim/po/af.po
index 8f06ed178c..eb6be42688 100644
--- a/src/nvim/po/af.po
+++ b/src/nvim/po/af.po
@@ -2722,11 +2722,6 @@ msgstr "E49: Ongeldige rolgrootte"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/ca.po b/src/nvim/po/ca.po
index 2b0d7611d0..7d32db9f97 100644
--- a/src/nvim/po/ca.po
+++ b/src/nvim/po/ca.po
@@ -2717,11 +2717,6 @@ msgstr "E49: La distncia de desplaament no s vlida"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/cs.cp1250.po b/src/nvim/po/cs.cp1250.po
index 339dfe6ae5..112e949815 100644
--- a/src/nvim/po/cs.cp1250.po
+++ b/src/nvim/po/cs.cp1250.po
@@ -2763,11 +2763,6 @@ msgstr "E49: Chybn hodnota volby 'scroll'"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/cs.po b/src/nvim/po/cs.po
index 5c19eecf32..3839230df2 100644
--- a/src/nvim/po/cs.po
+++ b/src/nvim/po/cs.po
@@ -2763,11 +2763,6 @@ msgstr "E49: Chybn hodnota volby 'scroll'"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/de.po b/src/nvim/po/de.po
index 4950533a21..f04d3be4b4 100644
--- a/src/nvim/po/de.po
+++ b/src/nvim/po/de.po
@@ -2137,11 +2137,6 @@ msgstr "E900: Ungltige Job-ID"
msgid "E901: Job table is full"
msgstr "E901: Job-Tabelle ist voll"
-#: ../globals.h:1021
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr "E902: \"%s\" ist nicht ausfhrbar"
-
#: ../globals.h:1023
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/en_GB.po b/src/nvim/po/en_GB.po
index 41e4cd895d..00a05195b4 100644
--- a/src/nvim/po/en_GB.po
+++ b/src/nvim/po/en_GB.po
@@ -2623,11 +2623,6 @@ msgstr ""
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/eo.po b/src/nvim/po/eo.po
index 8a3cd50406..d0a47d6e9b 100644
--- a/src/nvim/po/eo.po
+++ b/src/nvim/po/eo.po
@@ -2697,11 +2697,6 @@ msgstr "E49: Nevalida grando de rulumo"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/es.po b/src/nvim/po/es.po
index 9a3bfa6894..ed96e4de94 100644
--- a/src/nvim/po/es.po
+++ b/src/nvim/po/es.po
@@ -2748,11 +2748,6 @@ msgstr "E49: La longitud de desplazamiento no es válida"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/fi.po b/src/nvim/po/fi.po
index 6dfaa78a77..d30faeb554 100644
--- a/src/nvim/po/fi.po
+++ b/src/nvim/po/fi.po
@@ -2691,11 +2691,6 @@ msgstr "E49: Virheellinen vierityskoko"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/fr.po b/src/nvim/po/fr.po
index cd9f5a7eb2..bf0610de02 100644
--- a/src/nvim/po/fr.po
+++ b/src/nvim/po/fr.po
@@ -2879,11 +2879,6 @@ msgstr "E49: Valeur de dfilement invalide"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/ga.po b/src/nvim/po/ga.po
index d94b788449..761539039d 100644
--- a/src/nvim/po/ga.po
+++ b/src/nvim/po/ga.po
@@ -2684,11 +2684,6 @@ msgstr "E49: Mid neamhbhail scrollaithe"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/it.po b/src/nvim/po/it.po
index 119a8f02ff..6c62262675 100644
--- a/src/nvim/po/it.po
+++ b/src/nvim/po/it.po
@@ -2704,11 +2704,6 @@ msgstr "E900: 'Job id' non valido"
msgid "E901: Job table is full"
msgstr "E901: Job table piena"
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr "E902: \"%s\" non un esegubile"
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/ja.euc-jp.po b/src/nvim/po/ja.euc-jp.po
index e8d60d4438..c6425324b1 100644
--- a/src/nvim/po/ja.euc-jp.po
+++ b/src/nvim/po/ja.euc-jp.po
@@ -2684,11 +2684,6 @@ msgstr "E49: ̵ʥ̤Ǥ"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/ja.po b/src/nvim/po/ja.po
index fd3690f9bf..e12cfb7e70 100644
--- a/src/nvim/po/ja.po
+++ b/src/nvim/po/ja.po
@@ -2683,11 +2683,6 @@ msgstr "E49: 無効なスクロール量です"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/ko.UTF-8.po b/src/nvim/po/ko.UTF-8.po
index 3ed659208b..7afa507edb 100644
--- a/src/nvim/po/ko.UTF-8.po
+++ b/src/nvim/po/ko.UTF-8.po
@@ -2648,11 +2648,6 @@ msgstr "E49: 스크롤 크기가 잘못되었습니다"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/nb.po b/src/nvim/po/nb.po
index 76e42ddcd6..fefcf20b69 100644
--- a/src/nvim/po/nb.po
+++ b/src/nvim/po/nb.po
@@ -2699,11 +2699,6 @@ msgstr "E49: Ugyldig \"scroll\"-verdi"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/nl.po b/src/nvim/po/nl.po
index 6013b847cb..f2877903f2 100644
--- a/src/nvim/po/nl.po
+++ b/src/nvim/po/nl.po
@@ -2685,11 +2685,6 @@ msgstr "E49: ongeldige scroll-grootte"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/no.po b/src/nvim/po/no.po
index 76e42ddcd6..fefcf20b69 100644
--- a/src/nvim/po/no.po
+++ b/src/nvim/po/no.po
@@ -2699,11 +2699,6 @@ msgstr "E49: Ugyldig \"scroll\"-verdi"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/pl.UTF-8.po b/src/nvim/po/pl.UTF-8.po
index 2536efb422..0757afd3ae 100644
--- a/src/nvim/po/pl.UTF-8.po
+++ b/src/nvim/po/pl.UTF-8.po
@@ -2658,11 +2658,6 @@ msgstr "E49: Niewłaściwa wielkość przewinięcia"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/pt_BR.po b/src/nvim/po/pt_BR.po
index 60c11d4b5a..05986cf097 100644
--- a/src/nvim/po/pt_BR.po
+++ b/src/nvim/po/pt_BR.po
@@ -2478,11 +2478,6 @@ msgstr "E900: Id do job invlido"
msgid "E901: Job table is full"
msgstr "E901: Tabela de jobs está cheia"
-#: ../globals.h:1021
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr "E902: \"%s\" não é um executável"
-
#: ../globals.h:1023
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/ru.po b/src/nvim/po/ru.po
index 2511ef2c46..a4668743ba 100644
--- a/src/nvim/po/ru.po
+++ b/src/nvim/po/ru.po
@@ -2676,11 +2676,6 @@ msgstr "E49: Недопустимый размер прокрутки"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/sk.cp1250.po b/src/nvim/po/sk.cp1250.po
index b1b0bb6ade..4b1e64bd02 100644
--- a/src/nvim/po/sk.cp1250.po
+++ b/src/nvim/po/sk.cp1250.po
@@ -2689,11 +2689,6 @@ msgstr "E49: Chybn hodnota vekosti rolovania"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/sk.po b/src/nvim/po/sk.po
index 206e3e3ef6..e48a5de927 100644
--- a/src/nvim/po/sk.po
+++ b/src/nvim/po/sk.po
@@ -2689,11 +2689,6 @@ msgstr "E49: Chybn hodnota vekosti rolovania"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/sv.po b/src/nvim/po/sv.po
index eedaecd1e7..f27ffa0dd4 100644
--- a/src/nvim/po/sv.po
+++ b/src/nvim/po/sv.po
@@ -4742,11 +4742,6 @@ msgstr "E900: Ogiltigt jobb-id"
msgid "E901: Job table is full"
msgstr "E901: Jobbtabellen r full"
-#: ../globals.h:1008
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr "E902: \"%s\" r inte krbar"
-
#: ../globals.h:1009
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/uk.po b/src/nvim/po/uk.po
index f814b7c3db..bbbb462292 100644
--- a/src/nvim/po/uk.po
+++ b/src/nvim/po/uk.po
@@ -2433,10 +2433,6 @@ msgid "E901: Job table is full"
msgstr "E901: Таблиця завдань заповнена"
#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr "E902: \"%s\" не можна виконати"
-
-#, c-format
msgid "E903: Process for command \"%s\" could not be spawned"
msgstr "E903: Не вдалося запустити процес для команди «%s»"
diff --git a/src/nvim/po/vi.po b/src/nvim/po/vi.po
index 49c6765843..456e640a80 100644
--- a/src/nvim/po/vi.po
+++ b/src/nvim/po/vi.po
@@ -2720,11 +2720,6 @@ msgstr "E49: Kích thước thanh cuộn không cho phép"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/zh_CN.UTF-8.po b/src/nvim/po/zh_CN.UTF-8.po
index e88efed8e3..981719a2e7 100644
--- a/src/nvim/po/zh_CN.UTF-8.po
+++ b/src/nvim/po/zh_CN.UTF-8.po
@@ -2675,11 +2675,6 @@ msgstr "E49: 无效的滚动大小"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/src/nvim/po/zh_TW.UTF-8.po b/src/nvim/po/zh_TW.UTF-8.po
index da86d80c27..af8c3fff48 100644
--- a/src/nvim/po/zh_TW.UTF-8.po
+++ b/src/nvim/po/zh_TW.UTF-8.po
@@ -2725,11 +2725,6 @@ msgstr "E49: 錯誤的捲動大小"
msgid "E901: Job table is full"
msgstr ""
-#: ../globals.h:1022
-#, c-format
-msgid "E902: \"%s\" is not an executable"
-msgstr ""
-
#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua
index 9d24ba62db..79cc877cac 100644
--- a/test/functional/core/job_spec.lua
+++ b/test/functional/core/job_spec.lua
@@ -65,9 +65,22 @@ describe('jobs', function()
end)
it('returns 0 when it fails to start', function()
- local status, rv = pcall(eval, "jobstart([])")
- eq(false, status)
- ok(rv ~= nil)
+ eq("", eval("v:errmsg"))
+ execute("let g:test_jobid = jobstart([])")
+ eq(0, eval("g:test_jobid"))
+ eq("E474:", string.match(eval("v:errmsg"), "E%d*:"))
+ end)
+
+ it('returns -1 when target is not executable #5465', function()
+ local function new_job() return eval([[jobstart(['echo', 'foo'])]]) end
+ local executable_jobid = new_job()
+ local nonexecutable_jobid = eval(
+ "jobstart(['./test/functional/fixtures/non_executable.txt'])")
+ eq(-1, nonexecutable_jobid)
+ -- Should _not_ throw an error.
+ eq("", eval("v:errmsg"))
+ -- Non-executable job should not increment the job ids. #5465
+ eq(executable_jobid + 1, new_job())
end)
it('invokes callbacks when the job writes and exits', function()
diff --git a/test/functional/fixtures/non_executable.txt b/test/functional/fixtures/non_executable.txt
new file mode 100644
index 0000000000..cc27ecc664
--- /dev/null
+++ b/test/functional/fixtures/non_executable.txt
@@ -0,0 +1 @@
+This file is not an executable