mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 03:05:11 -07:00
parent
f344e40699
commit
c8d5e9230e
@ -11608,9 +11608,6 @@ 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);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -11646,6 +11643,7 @@ static void f_jobstart(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
|
||||
char **argv = tv_to_argv(&argvars[0], NULL);
|
||||
if (!argv) {
|
||||
rettv->vval.v_number = -1; // Return -1 on error.
|
||||
return; // Did error message in tv_to_argv.
|
||||
}
|
||||
|
||||
@ -16470,6 +16468,7 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
char *cmd;
|
||||
char **argv = tv_to_argv(&argvars[0], &cmd);
|
||||
if (!argv) {
|
||||
rettv->vval.v_number = -1; // Return -1 on error.
|
||||
return; // Did error message in tv_to_argv.
|
||||
}
|
||||
|
||||
|
@ -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"));
|
||||
|
@ -70,6 +70,12 @@ describe('jobs', function()
|
||||
ok(rv ~= nil)
|
||||
end)
|
||||
|
||||
it('returns -1 when target is not executable', function()
|
||||
local rv = eval("jobstart(['./test/functional/fixtures/non_executable.txt'])")
|
||||
eq(-1, rv)
|
||||
eq("", eval("v:errmsg"))
|
||||
end)
|
||||
|
||||
it('invokes callbacks when the job writes and exits', function()
|
||||
nvim('command', "call jobstart(['echo'], g:job_opts)")
|
||||
eq({'notification', 'stdout', {0, {'', ''}}}, next_msg())
|
||||
|
1
test/functional/fixtures/non_executable.txt
Normal file
1
test/functional/fixtures/non_executable.txt
Normal file
@ -0,0 +1 @@
|
||||
This file is not an executable
|
Loading…
Reference in New Issue
Block a user