Patch 7.4.2301
Problem: MS-Windows: some files remain after testing.
Solution: Close the channel output file. Wait for the file handle to be
closed before deleting the file.
Files: src/os_win32.c, src/testdir/test_channel.vim
*** ../vim-7.4.2300/src/os_win32.c 2016-08-29 22:48:12.161106080 +0200
--- src/os_win32.c 2016-09-01 18:31:42.646321433 +0200
***************
*** 5210,5220 ****
job->jv_job_object = jo;
job->jv_status = JOB_STARTED;
! if (!use_file_for_in)
! CloseHandle(ifd[0]);
! if (!use_file_for_out)
! CloseHandle(ofd[1]);
! if (!use_out_for_err && !use_file_for_err)
CloseHandle(efd[1]);
job->jv_channel = channel;
--- 5210,5218 ----
job->jv_job_object = jo;
job->jv_status = JOB_STARTED;
! CloseHandle(ifd[0]);
! CloseHandle(ofd[1]);
! if (!use_out_for_err && !use_null_for_err)
CloseHandle(efd[1]);
job->jv_channel = channel;
*** ../vim-7.4.2300/src/testdir/test_channel.vim 2016-09-01
15:11:13.544265437 +0200
--- src/testdir/test_channel.vim 2016-09-01 18:29:44.177529594 +0200
***************
*** 533,559 ****
call assert_equal(1, found_send)
call assert_equal(1, found_recv)
call assert_equal(1, found_stop)
call delete('Xlog')
endtry
endfunc
func Test_nl_read_file()
if !has('job')
return
endif
call ch_log('Test_nl_read_file()')
call writefile(['echo something', 'echoerr wrong', 'double this'], 'Xinput')
! let job = job_start(s:python . " test_channel_pipe.py",
\ {'in_io': 'file', 'in_name': 'Xinput'})
! call assert_equal("run", job_status(job))
try
! let handle = job_getchannel(job)
call assert_equal("something", ch_readraw(handle))
call assert_equal("wrong", ch_readraw(handle, {'part': 'err'}))
call assert_equal("this", ch_readraw(handle))
call assert_equal("AND this", ch_readraw(handle))
finally
! call job_stop(job)
call delete('Xinput')
endtry
endfunc
--- 533,571 ----
call assert_equal(1, found_send)
call assert_equal(1, found_recv)
call assert_equal(1, found_stop)
+ " On MS-Windows need to sleep for a moment to be able to delete the file.
+ sleep 10m
call delete('Xlog')
endtry
endfunc
+ func Stop_g_job()
+ call job_stop(g:job)
+ if has('win32')
+ " On MS-Windows the server must close the file handle before we are able
+ " to delete the file.
+ call WaitFor('job_status(g:job) == "dead"')
+ sleep 10m
+ endif
+ endfunc
+
func Test_nl_read_file()
if !has('job')
return
endif
call ch_log('Test_nl_read_file()')
call writefile(['echo something', 'echoerr wrong', 'double this'], 'Xinput')
! let g:job = job_start(s:python . " test_channel_pipe.py",
\ {'in_io': 'file', 'in_name': 'Xinput'})
! call assert_equal("run", job_status(g:job))
try
! let handle = job_getchannel(g:job)
call assert_equal("something", ch_readraw(handle))
call assert_equal("wrong", ch_readraw(handle, {'part': 'err'}))
call assert_equal("this", ch_readraw(handle))
call assert_equal("AND this", ch_readraw(handle))
finally
! call Stop_g_job()
call delete('Xinput')
endtry
endfunc
***************
*** 563,580 ****
return
endif
call ch_log('Test_nl_write_out_file()')
! let job = job_start(s:python . " test_channel_pipe.py",
\ {'out_io': 'file', 'out_name': 'Xoutput'})
! call assert_equal("run", job_status(job))
try
! let handle = job_getchannel(job)
call ch_sendraw(handle, "echo line one\n")
call ch_sendraw(handle, "echo line two\n")
call ch_sendraw(handle, "double this\n")
call WaitFor('len(readfile("Xoutput")) > 2')
call assert_equal(['line one', 'line two', 'this', 'AND this'],
readfile('Xoutput'))
finally
! call job_stop(job)
call delete('Xoutput')
endtry
endfunc
--- 575,592 ----
return
endif
call ch_log('Test_nl_write_out_file()')
! let g:job = job_start(s:python . " test_channel_pipe.py",
\ {'out_io': 'file', 'out_name': 'Xoutput'})
! call assert_equal("run", job_status(g:job))
try
! let handle = job_getchannel(g:job)
call ch_sendraw(handle, "echo line one\n")
call ch_sendraw(handle, "echo line two\n")
call ch_sendraw(handle, "double this\n")
call WaitFor('len(readfile("Xoutput")) > 2')
call assert_equal(['line one', 'line two', 'this', 'AND this'],
readfile('Xoutput'))
finally
! call Stop_g_job()
call delete('Xoutput')
endtry
endfunc
***************
*** 584,601 ****
return
endif
call ch_log('Test_nl_write_err_file()')
! let job = job_start(s:python . " test_channel_pipe.py",
\ {'err_io': 'file', 'err_name': 'Xoutput'})
! call assert_equal("run", job_status(job))
try
! let handle = job_getchannel(job)
call ch_sendraw(handle, "echoerr line one\n")
call ch_sendraw(handle, "echoerr line two\n")
call ch_sendraw(handle, "doubleerr this\n")
call WaitFor('len(readfile("Xoutput")) > 2')
call assert_equal(['line one', 'line two', 'this', 'AND this'],
readfile('Xoutput'))
finally
! call job_stop(job)
call delete('Xoutput')
endtry
endfunc
--- 596,613 ----
return
endif
call ch_log('Test_nl_write_err_file()')
! let g:job = job_start(s:python . " test_channel_pipe.py",
\ {'err_io': 'file', 'err_name': 'Xoutput'})
! call assert_equal("run", job_status(g:job))
try
! let handle = job_getchannel(g:job)
call ch_sendraw(handle, "echoerr line one\n")
call ch_sendraw(handle, "echoerr line two\n")
call ch_sendraw(handle, "doubleerr this\n")
call WaitFor('len(readfile("Xoutput")) > 2')
call assert_equal(['line one', 'line two', 'this', 'AND this'],
readfile('Xoutput'))
finally
! call Stop_g_job()
call delete('Xoutput')
endtry
endfunc
***************
*** 605,615 ****
return
endif
call ch_log('Test_nl_write_both_file()')
! let job = job_start(s:python . " test_channel_pipe.py",
\ {'out_io': 'file', 'out_name': 'Xoutput', 'err_io': 'out'})
! call assert_equal("run", job_status(job))
try
! let handle = job_getchannel(job)
call ch_sendraw(handle, "echoerr line one\n")
call ch_sendraw(handle, "echo line two\n")
call ch_sendraw(handle, "double this\n")
--- 617,627 ----
return
endif
call ch_log('Test_nl_write_both_file()')
! let g:job = job_start(s:python . " test_channel_pipe.py",
\ {'out_io': 'file', 'out_name': 'Xoutput', 'err_io': 'out'})
! call assert_equal("run", job_status(g:job))
try
! let handle = job_getchannel(g:job)
call ch_sendraw(handle, "echoerr line one\n")
call ch_sendraw(handle, "echo line two\n")
call ch_sendraw(handle, "double this\n")
***************
*** 617,623 ****
call WaitFor('len(readfile("Xoutput")) > 5')
call assert_equal(['line one', 'line two', 'this', 'AND this', 'that',
'AND that'], readfile('Xoutput'))
finally
! call job_stop(job)
call delete('Xoutput')
endtry
endfunc
--- 629,635 ----
call WaitFor('len(readfile("Xoutput")) > 5')
call assert_equal(['line one', 'line two', 'this', 'AND this', 'that',
'AND that'], readfile('Xoutput'))
finally
! call Stop_g_job()
call delete('Xoutput')
endtry
endfunc
*** ../vim-7.4.2300/src/version.c 2016-09-01 16:21:44.567629369 +0200
--- src/version.c 2016-09-01 18:31:09.654610519 +0200
***************
*** 765,766 ****
--- 765,768 ----
{ /* Add new patch number below this line */
+ /**/
+ 2301,
/**/
--
"Microsoft is like Coke. It's a secret formula, all the money is from
distribution, and their goal is to get Coke everywhere. Open source is like
selling water. There are water companies like Perrier and Poland Spring, but
you're competing with something that's free." -- Carl Howe
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.