mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	 Aaron Williamson
					Aaron Williamson
				
			
				
					committed by
					
						 Justin M. Keyes
						Justin M. Keyes
					
				
			
			
				
	
			
			
			 Justin M. Keyes
						Justin M. Keyes
					
				
			
						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); |   const char_u *exe = get_tv_string_chk(&argl->lv_first->li_tv); | ||||||
|   if (!exe || !os_can_exe(exe, NULL, true)) { |   if (!exe || !os_can_exe(exe, NULL, true)) { | ||||||
|     // String is not executable |     // String is not executable | ||||||
|     if (exe) { |  | ||||||
|       EMSG2(e_jobexe, exe); |  | ||||||
|     } |  | ||||||
|     return NULL; |     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); |   char **argv = tv_to_argv(&argvars[0], NULL); | ||||||
|   if (!argv) { |   if (!argv) { | ||||||
|  |     rettv->vval.v_number = -1;  // Return -1 on error. | ||||||
|     return;  // Did error message in tv_to_argv. |     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 *cmd; | ||||||
|   char **argv = tv_to_argv(&argvars[0], &cmd); |   char **argv = tv_to_argv(&argvars[0], &cmd); | ||||||
|   if (!argv) { |   if (!argv) { | ||||||
|  |     rettv->vval.v_number = -1;  // Return -1 on error. | ||||||
|     return;  // Did error message in tv_to_argv. |     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_isadir2[] INIT(= N_("E17: \"%s\" is a directory")); | ||||||
| EXTERN char_u e_invjob[] INIT(= N_("E900: Invalid job id")); | 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_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_( | EXTERN char_u e_jobspawn[] INIT(= N_( | ||||||
|       "E903: Process for command \"%s\" could not be spawned")); |       "E903: Process for command \"%s\" could not be spawned")); | ||||||
| EXTERN char_u e_jobnotpty[] INIT(= N_("E904: Job is not connected to a pty")); | 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) |     ok(rv ~= nil) | ||||||
|   end) |   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() |   it('invokes callbacks when the job writes and exits', function() | ||||||
|     nvim('command', "call jobstart(['echo'], g:job_opts)") |     nvim('command', "call jobstart(['echo'], g:job_opts)") | ||||||
|     eq({'notification', 'stdout', {0, {'', ''}}}, next_msg()) |     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 | ||||||
		Reference in New Issue
	
	Block a user