Skip to content

Commit a0f9cd1

Browse files
committed
patch 7.4.1247
Problem: The channel test doesn't run on MS-Windows. Solution: Make it work on the MS-Windows console. (Ken Takata)
1 parent 7c764f7 commit a0f9cd1

3 files changed

Lines changed: 33 additions & 11 deletions

File tree

src/testdir/test_channel.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
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.

src/testdir/test_channel.vim

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,40 @@
22
scriptencoding 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
817
endif
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+
1035
func 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()
5379
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ static char *(features[]) =
742742

743743
static int included_patches[] =
744744
{ /* Add new patch number below this line */
745+
/**/
746+
1247,
745747
/**/
746748
1246,
747749
/**/

0 commit comments

Comments
 (0)