To: vim_dev@googlegroups.com Subject: Patch 7.4.1247 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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) Files: src/testdir/test_channel.py, src/testdir/test_channel.vim *** ../vim-7.4.1246/src/testdir/test_channel.py 2016-02-02 23:22:38.101181704 +0100 --- src/testdir/test_channel.py 2016-02-03 20:05:35.225844786 +0100 *************** *** 7,18 **** # Then Vim can send requests to the server: # :let response = ch_sendexpr(handle, 'hello!') # - # And you can control Vim by typing a JSON message here, e.g.: - # ["ex","echo 'hi there'"] - # - # There is no prompt, just type a line and press Enter. - # To exit cleanly type "quit". - # # See ":help channel-demo" in Vim. # # This requires Python 2.6 or later. --- 7,12 ---- *** ../vim-7.4.1246/src/testdir/test_channel.vim 2016-02-02 23:22:38.101181704 +0100 --- src/testdir/test_channel.vim 2016-02-03 20:08:23.840091180 +0100 *************** *** 2,15 **** scriptencoding utf-8 " This requires the Python command to run the test server. ! " This most likely only works on Unix. ! if !has('unix') || !executable('python') finish endif func Test_communicate() " The Python program writes the port number in Xportnr. ! silent !./test_channel.py& " Wait for up to 2 seconds for the port number to be there. let cnt = 20 --- 2,41 ---- scriptencoding utf-8 " This requires the Python command to run the test server. ! " This most likely only works on Unix and Windows console. ! if has('unix') ! if !executable('python') ! finish ! endif ! elseif has('win32') && !has('gui_win32') ! " Use Python Launcher for Windows (py.exe). ! if !executable('py') ! finish ! endif ! else finish endif + func s:start_server() + if has('win32') + silent !start cmd /c start "test_channel" py test_channel.py + else + silent !./test_channel.py& + endif + endfunc + + func s:kill_server() + if has('win32') + call system('taskkill /IM py.exe /T /F /FI "WINDOWTITLE eq test_channel"') + else + call system("killall test_channel.py") + endif + endfunc + func Test_communicate() + call delete("Xportnr") " The Python program writes the port number in Xportnr. ! call s:start_server() " Wait for up to 2 seconds for the port number to be there. let cnt = 20 *************** *** 29,35 **** if len(l) == 0 " Can't make the connection, give up. ! call system("killall test_channel.py") return endif let port = l[0] --- 55,61 ---- if len(l) == 0 " Can't make the connection, give up. ! call s:kill_server() return endif let port = l[0] *************** *** 49,53 **** " make the server quit, can't check if this works, should not hang. call ch_sendexpr(handle, '!quit!', 0) ! call system("killall test_channel.py") endfunc --- 75,79 ---- " make the server quit, can't check if this works, should not hang. call ch_sendexpr(handle, '!quit!', 0) ! call s:kill_server() endfunc *** ../vim-7.4.1246/src/version.c 2016-02-02 23:22:38.101181704 +0100 --- src/version.c 2016-02-03 20:04:42.214396120 +0100 *************** *** 744,745 **** --- 744,747 ---- { /* Add new patch number below this line */ + /**/ + 1247, /**/ -- hundred-and-one symptoms of being an internet addict: 119. You are reading a book and look for the scroll bar to get to the next page. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///