File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77# Then Vim can send requests to the server:
88# :let response = ch_sendexpr(handle, 'hello!')
99#
10- # And you can control Vim by typing a JSON message here, e.g.:
11- # ["ex","echo 'hi there'"]
12- #
13- # There is no prompt, just type a line and press Enter.
14- # To exit cleanly type "quit<Enter>".
15- #
1610# See ":help channel-demo" in Vim.
1711#
1812# This requires Python 2.6 or later.
Original file line number Diff line number Diff line change 22scriptencoding utf- 8
33
44" This requires the Python command to run the test server.
5- " This most likely only works on Unix.
6- if ! has (' unix' ) || ! executable (' python' )
5+ " This most likely only works on Unix and Windows console.
6+ if has (' unix' )
7+ if ! executable (' python' )
8+ finish
9+ endif
10+ elseif has (' win32' ) && ! has (' gui_win32' )
11+ " Use Python Launcher for Windows (py.exe).
12+ if ! executable (' py' )
13+ finish
14+ endif
15+ else
716 finish
817endif
918
19+ func s: start_server ()
20+ if has (' win32' )
21+ silent ! start cmd /c start " test_channel" py test_channel.py
22+ else
23+ silent ! ./test_channel.py &
24+ endif
25+ endfunc
26+
27+ func s: kill_server ()
28+ if has (' win32' )
29+ call system (' taskkill /IM py.exe /T /F /FI "WINDOWTITLE eq test_channel"' )
30+ else
31+ call system (" killall test_channel.py" )
32+ endif
33+ endfunc
34+
1035func Test_communicate ()
36+ call delete (" Xportnr" )
1137 " The Python program writes the port number in Xportnr.
12- silent ! ./test_channel. py &
38+ call s: start_server ()
1339
1440 " Wait for up to 2 seconds for the port number to be there.
1541 let cnt = 20
@@ -29,7 +55,7 @@ func Test_communicate()
2955
3056 if len (l ) == 0
3157 " Can't make the connection, give up.
32- call system ( " killall test_channel.py " )
58+ call s: kill_server ( )
3359 return
3460 endif
3561 let port = l [0 ]
@@ -49,5 +75,5 @@ func Test_communicate()
4975 " make the server quit, can't check if this works, should not hang.
5076 call ch_sendexpr (handle, ' !quit!' , 0 )
5177
52- call system ( " killall test_channel.py " )
78+ call s: kill_server ( )
5379endfunc
Original file line number Diff line number Diff line change @@ -742,6 +742,8 @@ static char *(features[]) =
742742
743743static int included_patches [] =
744744{ /* Add new patch number below this line */
745+ /**/
746+ 1247 ,
745747/**/
746748 1246 ,
747749/**/
You can’t perform that action at this time.
0 commit comments