Mercurial > vim
annotate src/testdir/test_system.vim @ 18195:a81f0c936112 v8.1.2092
patch 8.1.2092: MS-Windows: redirect in system() does not work
Commit: https://github.com/vim/vim/commit/1a613398068580ca1286ac2ed920f20c978aa662
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 28 15:51:37 2019 +0200
patch 8.1.2092: MS-Windows: redirect in system() does not work
Problem: MS-Windows: redirect in system() does not work.
Solution: Handle 'shellxescape' and 'shellxquote' better. (Yasuhiro
Matsumoto, closes #2054)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 28 Sep 2019 16:00:03 +0200 |
parents | 131f1d8c5860 |
children | 78d4902b22df |
rev | line source |
---|---|
10522
7232cd9f8a7c
commit https://github.com/vim/vim/commit/12c4492dd35e0cd83c8816be2ec849b836109882
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for system() and systemlist() |
7232cd9f8a7c
commit https://github.com/vim/vim/commit/12c4492dd35e0cd83c8816be2ec849b836109882
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
17698
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
3 source shared.vim |
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
4 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
11637
diff
changeset
|
5 func Test_System() |
18195
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
6 if !has('win32') |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
7 call assert_equal("123\n", system('echo 123')) |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
8 call assert_equal(['123'], systemlist('echo 123')) |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
9 call assert_equal('123', system('cat', '123')) |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
10 call assert_equal(['123'], systemlist('cat', '123')) |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
11 call assert_equal(["as\<NL>df"], systemlist('cat', ["as\<NL>df"])) |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
12 else |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
13 call assert_equal("123\n", system('echo 123')) |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
14 call assert_equal(["123\r"], systemlist('echo 123')) |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
15 call assert_equal("123", system('more', '123')) |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
16 call assert_equal(["123"], systemlist('more', '123')) |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
17 call assert_equal(["as\<NL>df"], systemlist('more', ["as\<NL>df"])) |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
18 endif |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
19 |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
20 if !executable('cat') || !executable('wc') |
10522
7232cd9f8a7c
commit https://github.com/vim/vim/commit/12c4492dd35e0cd83c8816be2ec849b836109882
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 return |
7232cd9f8a7c
commit https://github.com/vim/vim/commit/12c4492dd35e0cd83c8816be2ec849b836109882
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 endif |
18195
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
23 |
17624
4c7097a980a5
patch 8.1.1809: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
24 let out = 'echo 123'->system() |
10526
06724e21d8c1
commit https://github.com/vim/vim/commit/9d9c35651712b88c81f1ae11091de1fd0bbbd35c
Christian Brabandt <cb@256bit.org>
parents:
10522
diff
changeset
|
25 " On Windows we may get a trailing space. |
06724e21d8c1
commit https://github.com/vim/vim/commit/9d9c35651712b88c81f1ae11091de1fd0bbbd35c
Christian Brabandt <cb@256bit.org>
parents:
10522
diff
changeset
|
26 if out != "123 \n" |
06724e21d8c1
commit https://github.com/vim/vim/commit/9d9c35651712b88c81f1ae11091de1fd0bbbd35c
Christian Brabandt <cb@256bit.org>
parents:
10522
diff
changeset
|
27 call assert_equal("123\n", out) |
06724e21d8c1
commit https://github.com/vim/vim/commit/9d9c35651712b88c81f1ae11091de1fd0bbbd35c
Christian Brabandt <cb@256bit.org>
parents:
10522
diff
changeset
|
28 endif |
06724e21d8c1
commit https://github.com/vim/vim/commit/9d9c35651712b88c81f1ae11091de1fd0bbbd35c
Christian Brabandt <cb@256bit.org>
parents:
10522
diff
changeset
|
29 |
17624
4c7097a980a5
patch 8.1.1809: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
30 let out = 'echo 123'->systemlist() |
18195
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
31 if !has('win32') |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
32 call assert_equal(["123"], out) |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
33 else |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
34 call assert_equal(["123\r"], out) |
10526
06724e21d8c1
commit https://github.com/vim/vim/commit/9d9c35651712b88c81f1ae11091de1fd0bbbd35c
Christian Brabandt <cb@256bit.org>
parents:
10522
diff
changeset
|
35 endif |
06724e21d8c1
commit https://github.com/vim/vim/commit/9d9c35651712b88c81f1ae11091de1fd0bbbd35c
Christian Brabandt <cb@256bit.org>
parents:
10522
diff
changeset
|
36 |
18195
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
37 if executable('cat') |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
38 call assert_equal('123', system('cat', '123')) |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
39 call assert_equal(['123'], systemlist('cat', '123')) |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
40 call assert_equal(["as\<NL>df"], systemlist('cat', ["as\<NL>df"])) |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
41 endif |
10528
3ea703795a4f
commit https://github.com/vim/vim/commit/31f19ce0a052f7c76d44a9a190e468c79cf5d56d
Christian Brabandt <cb@256bit.org>
parents:
10526
diff
changeset
|
42 |
10522
7232cd9f8a7c
commit https://github.com/vim/vim/commit/12c4492dd35e0cd83c8816be2ec849b836109882
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 new Xdummy |
7232cd9f8a7c
commit https://github.com/vim/vim/commit/12c4492dd35e0cd83c8816be2ec849b836109882
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 call setline(1, ['asdf', "pw\<NL>er", 'xxxx']) |
10528
3ea703795a4f
commit https://github.com/vim/vim/commit/31f19ce0a052f7c76d44a9a190e468c79cf5d56d
Christian Brabandt <cb@256bit.org>
parents:
10526
diff
changeset
|
45 let out = system('wc -l', bufnr('%')) |
3ea703795a4f
commit https://github.com/vim/vim/commit/31f19ce0a052f7c76d44a9a190e468c79cf5d56d
Christian Brabandt <cb@256bit.org>
parents:
10526
diff
changeset
|
46 " On OS/X we get leading spaces |
3ea703795a4f
commit https://github.com/vim/vim/commit/31f19ce0a052f7c76d44a9a190e468c79cf5d56d
Christian Brabandt <cb@256bit.org>
parents:
10526
diff
changeset
|
47 let out = substitute(out, '^ *', '', '') |
3ea703795a4f
commit https://github.com/vim/vim/commit/31f19ce0a052f7c76d44a9a190e468c79cf5d56d
Christian Brabandt <cb@256bit.org>
parents:
10526
diff
changeset
|
48 call assert_equal("3\n", out) |
10526
06724e21d8c1
commit https://github.com/vim/vim/commit/9d9c35651712b88c81f1ae11091de1fd0bbbd35c
Christian Brabandt <cb@256bit.org>
parents:
10522
diff
changeset
|
49 |
06724e21d8c1
commit https://github.com/vim/vim/commit/9d9c35651712b88c81f1ae11091de1fd0bbbd35c
Christian Brabandt <cb@256bit.org>
parents:
10522
diff
changeset
|
50 let out = systemlist('wc -l', bufnr('%')) |
06724e21d8c1
commit https://github.com/vim/vim/commit/9d9c35651712b88c81f1ae11091de1fd0bbbd35c
Christian Brabandt <cb@256bit.org>
parents:
10522
diff
changeset
|
51 " On Windows we may get a trailing CR. |
06724e21d8c1
commit https://github.com/vim/vim/commit/9d9c35651712b88c81f1ae11091de1fd0bbbd35c
Christian Brabandt <cb@256bit.org>
parents:
10522
diff
changeset
|
52 if out != ["3\r"] |
10528
3ea703795a4f
commit https://github.com/vim/vim/commit/31f19ce0a052f7c76d44a9a190e468c79cf5d56d
Christian Brabandt <cb@256bit.org>
parents:
10526
diff
changeset
|
53 " On OS/X we get leading spaces |
3ea703795a4f
commit https://github.com/vim/vim/commit/31f19ce0a052f7c76d44a9a190e468c79cf5d56d
Christian Brabandt <cb@256bit.org>
parents:
10526
diff
changeset
|
54 if type(out) == v:t_list |
3ea703795a4f
commit https://github.com/vim/vim/commit/31f19ce0a052f7c76d44a9a190e468c79cf5d56d
Christian Brabandt <cb@256bit.org>
parents:
10526
diff
changeset
|
55 let out[0] = substitute(out[0], '^ *', '', '') |
3ea703795a4f
commit https://github.com/vim/vim/commit/31f19ce0a052f7c76d44a9a190e468c79cf5d56d
Christian Brabandt <cb@256bit.org>
parents:
10526
diff
changeset
|
56 endif |
10526
06724e21d8c1
commit https://github.com/vim/vim/commit/9d9c35651712b88c81f1ae11091de1fd0bbbd35c
Christian Brabandt <cb@256bit.org>
parents:
10522
diff
changeset
|
57 call assert_equal(['3'], out) |
06724e21d8c1
commit https://github.com/vim/vim/commit/9d9c35651712b88c81f1ae11091de1fd0bbbd35c
Christian Brabandt <cb@256bit.org>
parents:
10522
diff
changeset
|
58 endif |
06724e21d8c1
commit https://github.com/vim/vim/commit/9d9c35651712b88c81f1ae11091de1fd0bbbd35c
Christian Brabandt <cb@256bit.org>
parents:
10522
diff
changeset
|
59 |
18195
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
60 if !has('win32') |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
61 let out = systemlist('cat', bufnr('%')) |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
62 call assert_equal(['asdf', "pw\<NL>er", 'xxxx'], out) |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
63 else |
a81f0c936112
patch 8.1.2092: MS-Windows: redirect in system() does not work
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
64 let out = systemlist('more', bufnr('%')) |
10526
06724e21d8c1
commit https://github.com/vim/vim/commit/9d9c35651712b88c81f1ae11091de1fd0bbbd35c
Christian Brabandt <cb@256bit.org>
parents:
10522
diff
changeset
|
65 call assert_equal(['asdf', "pw\<NL>er", 'xxxx'], out) |
06724e21d8c1
commit https://github.com/vim/vim/commit/9d9c35651712b88c81f1ae11091de1fd0bbbd35c
Christian Brabandt <cb@256bit.org>
parents:
10522
diff
changeset
|
66 endif |
10522
7232cd9f8a7c
commit https://github.com/vim/vim/commit/12c4492dd35e0cd83c8816be2ec849b836109882
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 bwipe! |
7232cd9f8a7c
commit https://github.com/vim/vim/commit/12c4492dd35e0cd83c8816be2ec849b836109882
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 |
7232cd9f8a7c
commit https://github.com/vim/vim/commit/12c4492dd35e0cd83c8816be2ec849b836109882
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 call assert_fails('call system("wc -l", 99999)', 'E86:') |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
11637
diff
changeset
|
70 endfunc |
10589
b0c9c1a05054
patch 8.0.0184: when an error is caught Vim still exits with non-zero result
Christian Brabandt <cb@256bit.org>
parents:
10528
diff
changeset
|
71 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
11637
diff
changeset
|
72 func Test_system_exmode() |
10615
de4aae865134
patch 8.0.0197: system() test skips some parts for MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10591
diff
changeset
|
73 if has('unix') " echo $? only works on Unix |
17698
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
74 let cmd = ' -es -c "source Xscript" +q; echo "result=$?"' |
10615
de4aae865134
patch 8.0.0197: system() test skips some parts for MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10591
diff
changeset
|
75 " Need to put this in a script, "catch" isn't found after an unknown |
de4aae865134
patch 8.0.0197: system() test skips some parts for MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10591
diff
changeset
|
76 " function. |
de4aae865134
patch 8.0.0197: system() test skips some parts for MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10591
diff
changeset
|
77 call writefile(['try', 'call doesnotexist()', 'catch', 'endtry'], 'Xscript') |
17698
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
78 let a = system(GetVimCommand() . cmd) |
11637
bcab4e804c20
patch 8.0.0701: system test failing when using X11 forwarding
Christian Brabandt <cb@256bit.org>
parents:
10615
diff
changeset
|
79 call assert_match('result=0', a) |
10615
de4aae865134
patch 8.0.0197: system() test skips some parts for MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10591
diff
changeset
|
80 call assert_equal(0, v:shell_error) |
10591
234da476c4fd
patch 8.0.0185: system() test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10589
diff
changeset
|
81 endif |
234da476c4fd
patch 8.0.0185: system() test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10589
diff
changeset
|
82 |
10589
b0c9c1a05054
patch 8.0.0184: when an error is caught Vim still exits with non-zero result
Christian Brabandt <cb@256bit.org>
parents:
10528
diff
changeset
|
83 " Error before try does set error flag. |
b0c9c1a05054
patch 8.0.0184: when an error is caught Vim still exits with non-zero result
Christian Brabandt <cb@256bit.org>
parents:
10528
diff
changeset
|
84 call writefile(['call nosuchfunction()', 'try', 'call doesnotexist()', 'catch', 'endtry'], 'Xscript') |
10615
de4aae865134
patch 8.0.0197: system() test skips some parts for MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10591
diff
changeset
|
85 if has('unix') " echo $? only works on Unix |
17698
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
86 let a = system(GetVimCommand() . cmd) |
10615
de4aae865134
patch 8.0.0197: system() test skips some parts for MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10591
diff
changeset
|
87 call assert_notequal('0', a[0]) |
de4aae865134
patch 8.0.0197: system() test skips some parts for MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10591
diff
changeset
|
88 endif |
10589
b0c9c1a05054
patch 8.0.0184: when an error is caught Vim still exits with non-zero result
Christian Brabandt <cb@256bit.org>
parents:
10528
diff
changeset
|
89 |
17698
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
90 let cmd = ' -es -c "source Xscript" +q' |
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
91 let a = system(GetVimCommand() . cmd) |
10589
b0c9c1a05054
patch 8.0.0184: when an error is caught Vim still exits with non-zero result
Christian Brabandt <cb@256bit.org>
parents:
10528
diff
changeset
|
92 call assert_notequal(0, v:shell_error) |
10615
de4aae865134
patch 8.0.0197: system() test skips some parts for MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10591
diff
changeset
|
93 call delete('Xscript') |
10589
b0c9c1a05054
patch 8.0.0184: when an error is caught Vim still exits with non-zero result
Christian Brabandt <cb@256bit.org>
parents:
10528
diff
changeset
|
94 |
10615
de4aae865134
patch 8.0.0197: system() test skips some parts for MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10591
diff
changeset
|
95 if has('unix') " echo $? only works on Unix |
17698
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
96 let cmd = ' -es -c "call doesnotexist()" +q; echo $?' |
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
97 let a = system(GetVimCommand() . cmd) |
10615
de4aae865134
patch 8.0.0197: system() test skips some parts for MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10591
diff
changeset
|
98 call assert_notequal(0, a[0]) |
de4aae865134
patch 8.0.0197: system() test skips some parts for MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10591
diff
changeset
|
99 endif |
10589
b0c9c1a05054
patch 8.0.0184: when an error is caught Vim still exits with non-zero result
Christian Brabandt <cb@256bit.org>
parents:
10528
diff
changeset
|
100 |
17698
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
101 let cmd = ' -es -c "call doesnotexist()" +q' |
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
102 let a = system(GetVimCommand(). cmd) |
10589
b0c9c1a05054
patch 8.0.0184: when an error is caught Vim still exits with non-zero result
Christian Brabandt <cb@256bit.org>
parents:
10528
diff
changeset
|
103 call assert_notequal(0, v:shell_error) |
b0c9c1a05054
patch 8.0.0184: when an error is caught Vim still exits with non-zero result
Christian Brabandt <cb@256bit.org>
parents:
10528
diff
changeset
|
104 |
10615
de4aae865134
patch 8.0.0197: system() test skips some parts for MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10591
diff
changeset
|
105 if has('unix') " echo $? only works on Unix |
17698
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
106 let cmd = ' -es -c "call doesnotexist()|let a=1" +q; echo $?' |
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
107 let a = system(GetVimCommand() . cmd) |
10615
de4aae865134
patch 8.0.0197: system() test skips some parts for MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10591
diff
changeset
|
108 call assert_notequal(0, a[0]) |
de4aae865134
patch 8.0.0197: system() test skips some parts for MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
10591
diff
changeset
|
109 endif |
10589
b0c9c1a05054
patch 8.0.0184: when an error is caught Vim still exits with non-zero result
Christian Brabandt <cb@256bit.org>
parents:
10528
diff
changeset
|
110 |
17698
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
111 let cmd = ' -es -c "call doesnotexist()|let a=1" +q' |
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
112 let a = system(GetVimCommand() . cmd) |
10589
b0c9c1a05054
patch 8.0.0184: when an error is caught Vim still exits with non-zero result
Christian Brabandt <cb@256bit.org>
parents:
10528
diff
changeset
|
113 call assert_notequal(0, v:shell_error) |
b0c9c1a05054
patch 8.0.0184: when an error is caught Vim still exits with non-zero result
Christian Brabandt <cb@256bit.org>
parents:
10528
diff
changeset
|
114 endfunc |