mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
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.
This commit is contained in:
parent
5c80908ced
commit
641ad6c7ac
@ -5210,11 +5210,9 @@ mch_start_job(char *cmd, job_T *job, jobopt_T *options)
|
|||||||
job->jv_job_object = jo;
|
job->jv_job_object = jo;
|
||||||
job->jv_status = JOB_STARTED;
|
job->jv_status = JOB_STARTED;
|
||||||
|
|
||||||
if (!use_file_for_in)
|
CloseHandle(ifd[0]);
|
||||||
CloseHandle(ifd[0]);
|
CloseHandle(ofd[1]);
|
||||||
if (!use_file_for_out)
|
if (!use_out_for_err && !use_null_for_err)
|
||||||
CloseHandle(ofd[1]);
|
|
||||||
if (!use_out_for_err && !use_file_for_err)
|
|
||||||
CloseHandle(efd[1]);
|
CloseHandle(efd[1]);
|
||||||
|
|
||||||
job->jv_channel = channel;
|
job->jv_channel = channel;
|
||||||
|
@ -533,27 +533,39 @@ func Test_nl_err_to_out_pipe()
|
|||||||
call assert_equal(1, found_send)
|
call assert_equal(1, found_send)
|
||||||
call assert_equal(1, found_recv)
|
call assert_equal(1, found_recv)
|
||||||
call assert_equal(1, found_stop)
|
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')
|
call delete('Xlog')
|
||||||
endtry
|
endtry
|
||||||
endfunc
|
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()
|
func Test_nl_read_file()
|
||||||
if !has('job')
|
if !has('job')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
call ch_log('Test_nl_read_file()')
|
call ch_log('Test_nl_read_file()')
|
||||||
call writefile(['echo something', 'echoerr wrong', 'double this'], 'Xinput')
|
call writefile(['echo something', 'echoerr wrong', 'double this'], 'Xinput')
|
||||||
let job = job_start(s:python . " test_channel_pipe.py",
|
let g:job = job_start(s:python . " test_channel_pipe.py",
|
||||||
\ {'in_io': 'file', 'in_name': 'Xinput'})
|
\ {'in_io': 'file', 'in_name': 'Xinput'})
|
||||||
call assert_equal("run", job_status(job))
|
call assert_equal("run", job_status(g:job))
|
||||||
try
|
try
|
||||||
let handle = job_getchannel(job)
|
let handle = job_getchannel(g:job)
|
||||||
call assert_equal("something", ch_readraw(handle))
|
call assert_equal("something", ch_readraw(handle))
|
||||||
call assert_equal("wrong", ch_readraw(handle, {'part': 'err'}))
|
call assert_equal("wrong", ch_readraw(handle, {'part': 'err'}))
|
||||||
call assert_equal("this", ch_readraw(handle))
|
call assert_equal("this", ch_readraw(handle))
|
||||||
call assert_equal("AND this", ch_readraw(handle))
|
call assert_equal("AND this", ch_readraw(handle))
|
||||||
finally
|
finally
|
||||||
call job_stop(job)
|
call Stop_g_job()
|
||||||
call delete('Xinput')
|
call delete('Xinput')
|
||||||
endtry
|
endtry
|
||||||
endfunc
|
endfunc
|
||||||
@ -563,18 +575,18 @@ func Test_nl_write_out_file()
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
call ch_log('Test_nl_write_out_file()')
|
call ch_log('Test_nl_write_out_file()')
|
||||||
let job = job_start(s:python . " test_channel_pipe.py",
|
let g:job = job_start(s:python . " test_channel_pipe.py",
|
||||||
\ {'out_io': 'file', 'out_name': 'Xoutput'})
|
\ {'out_io': 'file', 'out_name': 'Xoutput'})
|
||||||
call assert_equal("run", job_status(job))
|
call assert_equal("run", job_status(g:job))
|
||||||
try
|
try
|
||||||
let handle = job_getchannel(job)
|
let handle = job_getchannel(g:job)
|
||||||
call ch_sendraw(handle, "echo line one\n")
|
call ch_sendraw(handle, "echo line one\n")
|
||||||
call ch_sendraw(handle, "echo line two\n")
|
call ch_sendraw(handle, "echo line two\n")
|
||||||
call ch_sendraw(handle, "double this\n")
|
call ch_sendraw(handle, "double this\n")
|
||||||
call WaitFor('len(readfile("Xoutput")) > 2')
|
call WaitFor('len(readfile("Xoutput")) > 2')
|
||||||
call assert_equal(['line one', 'line two', 'this', 'AND this'], readfile('Xoutput'))
|
call assert_equal(['line one', 'line two', 'this', 'AND this'], readfile('Xoutput'))
|
||||||
finally
|
finally
|
||||||
call job_stop(job)
|
call Stop_g_job()
|
||||||
call delete('Xoutput')
|
call delete('Xoutput')
|
||||||
endtry
|
endtry
|
||||||
endfunc
|
endfunc
|
||||||
@ -584,18 +596,18 @@ func Test_nl_write_err_file()
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
call ch_log('Test_nl_write_err_file()')
|
call ch_log('Test_nl_write_err_file()')
|
||||||
let job = job_start(s:python . " test_channel_pipe.py",
|
let g:job = job_start(s:python . " test_channel_pipe.py",
|
||||||
\ {'err_io': 'file', 'err_name': 'Xoutput'})
|
\ {'err_io': 'file', 'err_name': 'Xoutput'})
|
||||||
call assert_equal("run", job_status(job))
|
call assert_equal("run", job_status(g:job))
|
||||||
try
|
try
|
||||||
let handle = job_getchannel(job)
|
let handle = job_getchannel(g:job)
|
||||||
call ch_sendraw(handle, "echoerr line one\n")
|
call ch_sendraw(handle, "echoerr line one\n")
|
||||||
call ch_sendraw(handle, "echoerr line two\n")
|
call ch_sendraw(handle, "echoerr line two\n")
|
||||||
call ch_sendraw(handle, "doubleerr this\n")
|
call ch_sendraw(handle, "doubleerr this\n")
|
||||||
call WaitFor('len(readfile("Xoutput")) > 2')
|
call WaitFor('len(readfile("Xoutput")) > 2')
|
||||||
call assert_equal(['line one', 'line two', 'this', 'AND this'], readfile('Xoutput'))
|
call assert_equal(['line one', 'line two', 'this', 'AND this'], readfile('Xoutput'))
|
||||||
finally
|
finally
|
||||||
call job_stop(job)
|
call Stop_g_job()
|
||||||
call delete('Xoutput')
|
call delete('Xoutput')
|
||||||
endtry
|
endtry
|
||||||
endfunc
|
endfunc
|
||||||
@ -605,11 +617,11 @@ func Test_nl_write_both_file()
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
call ch_log('Test_nl_write_both_file()')
|
call ch_log('Test_nl_write_both_file()')
|
||||||
let job = job_start(s:python . " test_channel_pipe.py",
|
let g:job = job_start(s:python . " test_channel_pipe.py",
|
||||||
\ {'out_io': 'file', 'out_name': 'Xoutput', 'err_io': 'out'})
|
\ {'out_io': 'file', 'out_name': 'Xoutput', 'err_io': 'out'})
|
||||||
call assert_equal("run", job_status(job))
|
call assert_equal("run", job_status(g:job))
|
||||||
try
|
try
|
||||||
let handle = job_getchannel(job)
|
let handle = job_getchannel(g:job)
|
||||||
call ch_sendraw(handle, "echoerr line one\n")
|
call ch_sendraw(handle, "echoerr line one\n")
|
||||||
call ch_sendraw(handle, "echo line two\n")
|
call ch_sendraw(handle, "echo line two\n")
|
||||||
call ch_sendraw(handle, "double this\n")
|
call ch_sendraw(handle, "double this\n")
|
||||||
@ -617,7 +629,7 @@ func Test_nl_write_both_file()
|
|||||||
call WaitFor('len(readfile("Xoutput")) > 5')
|
call WaitFor('len(readfile("Xoutput")) > 5')
|
||||||
call assert_equal(['line one', 'line two', 'this', 'AND this', 'that', 'AND that'], readfile('Xoutput'))
|
call assert_equal(['line one', 'line two', 'this', 'AND this', 'that', 'AND that'], readfile('Xoutput'))
|
||||||
finally
|
finally
|
||||||
call job_stop(job)
|
call Stop_g_job()
|
||||||
call delete('Xoutput')
|
call delete('Xoutput')
|
||||||
endtry
|
endtry
|
||||||
endfunc
|
endfunc
|
||||||
|
@ -763,6 +763,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2301,
|
||||||
/**/
|
/**/
|
||||||
2300,
|
2300,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user