Patch 8.2.3232 (after 8.2.3229)
Problem: system() does not work without a second argument.
Solution: Do not require a second argument. (Yegappan Lakshmanan,
closes #8651, closes #8650)
Files: src/misc1.c, src/proto/
typval.pro,
src/testdir/test_vim9_builtin.vim, src/typval.c
*** ../vim-8.2.3231/src/misc1.c 2021-07-27 22:00:39.749712387 +0200
--- src/misc1.c 2021-07-28 11:47:57.421710069 +0200
***************
*** 2359,2365 ****
if (in_vim9script()
&& (check_for_string_arg(argvars, 0) == FAIL
! || check_for_string_or_number_or_list_arg(argvars, 1) == FAIL))
return;
if (argvars[1].v_type != VAR_UNKNOWN)
--- 2359,2365 ----
if (in_vim9script()
&& (check_for_string_arg(argvars, 0) == FAIL
! || check_for_opt_string_or_number_or_list_arg(argvars, 1) == FAIL))
return;
if (argvars[1].v_type != VAR_UNKNOWN)
*** ../vim-8.2.3231/src/proto/
typval.pro 2021-07-27 22:00:39.749712387 +0200
--- src/proto/
typval.pro 2021-07-28 11:47:57.421710069 +0200
***************
*** 36,41 ****
--- 36,42 ----
int check_for_opt_string_or_list_arg(typval_T *args, int idx);
int check_for_string_or_dict_arg(typval_T *args, int idx);
int check_for_string_or_number_or_list_arg(typval_T *args, int idx);
+ int check_for_opt_string_or_number_or_list_arg(typval_T *args, int idx);
int check_for_string_or_list_or_dict_arg(typval_T *args, int idx);
int check_for_list_or_blob_arg(typval_T *args, int idx);
int check_for_list_or_dict_arg(typval_T *args, int idx);
*** ../vim-8.2.3231/src/testdir/test_vim9_builtin.vim 2021-07-27 22:21:39.827052451 +0200
--- src/testdir/test_vim9_builtin.vim 2021-07-28 11:47:57.421710069 +0200
***************
*** 3290,3300 ****
--- 3290,3306 ----
def Test_system()
CheckDefAndScriptFailure2(['system(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
CheckDefAndScriptFailure2(['system("a", {})'], 'E1013: Argument 2: type mismatch, expected string but got dict<unknown>', 'E1224: String or List required for argument 2')
+ assert_equal("123\n", system('echo 123'))
enddef
def Test_systemlist()
CheckDefAndScriptFailure2(['systemlist(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
CheckDefAndScriptFailure2(['systemlist("a", {})'], 'E1013: Argument 2: type mismatch, expected string but got dict<unknown>', 'E1224: String or List required for argument 2')
+ if has('win32')
+ call assert_equal(["123\r"], systemlist('echo 123'))
+ else
+ call assert_equal(['123'], systemlist('echo 123'))
+ endif
enddef
def Test_tabpagebuflist()
*** ../vim-8.2.3231/src/typval.c 2021-07-27 22:00:39.753712380 +0200
--- src/typval.c 2021-07-28 11:47:57.421710069 +0200
***************
*** 727,732 ****
--- 727,743 ----
}
/*
+ * Give an error and return FAIL unless "args[idx]" is an optional string
+ * or number or a list
+ */
+ int
+ check_for_opt_string_or_number_or_list_arg(typval_T *args, int idx)
+ {
+ return (args[idx].v_type == VAR_UNKNOWN
+ || check_for_string_or_number_or_list_arg(args, idx) != FAIL);
+ }
+
+ /*
* Give an error and return FAIL unless "args[idx]" is a string or a list
* or a dict.
*/
*** ../vim-8.2.3231/src/version.c 2021-07-27 22:35:38.957378663 +0200
--- src/version.c 2021-07-28 11:51:16.829140276 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3232,
/**/
--
hundred-and-one symptoms of being an internet addict:
256. You are able to write down over 250 symptoms of being an internet
addict, even though they only asked for 101.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///