mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 7.4.1807
Problem: Test_out_close_cb sometimes fails. Solution: Always write DETACH to out, not err.
This commit is contained in:
parent
8e3d1b6326
commit
d75263c020
@ -2478,6 +2478,7 @@ channel_close(channel_T *channel, int invoke_close_cb)
|
|||||||
* first invoke the close callback. Increment the refcount to avoid
|
* first invoke the close callback. Increment the refcount to avoid
|
||||||
* the channel being freed halfway. */
|
* the channel being freed halfway. */
|
||||||
++channel->ch_refcount;
|
++channel->ch_refcount;
|
||||||
|
ch_log(channel, "Invoking callbacks before closing");
|
||||||
for (part = PART_SOCK; part <= PART_ERR; ++part)
|
for (part = PART_SOCK; part <= PART_ERR; ++part)
|
||||||
while (may_invoke_callback(channel, part))
|
while (may_invoke_callback(channel, part))
|
||||||
;
|
;
|
||||||
@ -2783,7 +2784,7 @@ channel_close_on_error(channel_T *channel, int part, char *func)
|
|||||||
*/
|
*/
|
||||||
if (channel->ch_part[part].ch_mode == MODE_RAW
|
if (channel->ch_part[part].ch_mode == MODE_RAW
|
||||||
|| channel->ch_part[part].ch_mode == MODE_NL)
|
|| channel->ch_part[part].ch_mode == MODE_NL)
|
||||||
channel_save(channel, part, (char_u *)DETACH_MSG_RAW,
|
channel_save(channel, PART_OUT, (char_u *)DETACH_MSG_RAW,
|
||||||
(int)STRLEN(DETACH_MSG_RAW), FALSE, "PUT ");
|
(int)STRLEN(DETACH_MSG_RAW), FALSE, "PUT ");
|
||||||
|
|
||||||
/* When reading from stdout is not possible, assume the other side has
|
/* When reading from stdout is not possible, assume the other side has
|
||||||
|
@ -1055,10 +1055,15 @@ func Test_out_close_cb()
|
|||||||
call ch_log('Test_out_close_cb()')
|
call ch_log('Test_out_close_cb()')
|
||||||
|
|
||||||
let s:counter = 1
|
let s:counter = 1
|
||||||
let s:outmsg = 0
|
let s:msg1 = ''
|
||||||
|
let s:msg2 = ''
|
||||||
let s:closemsg = 0
|
let s:closemsg = 0
|
||||||
func! OutHandler(chan, msg)
|
func! OutHandler(chan, msg)
|
||||||
let s:outmsg = s:counter
|
if s:counter == 1
|
||||||
|
let s:msg1 = a:msg
|
||||||
|
else
|
||||||
|
let s:msg2 = a:msg
|
||||||
|
endif
|
||||||
let s:counter += 1
|
let s:counter += 1
|
||||||
endfunc
|
endfunc
|
||||||
func! CloseHandler(chan)
|
func! CloseHandler(chan)
|
||||||
@ -1070,9 +1075,10 @@ func Test_out_close_cb()
|
|||||||
\ 'close_cb': 'CloseHandler'})
|
\ 'close_cb': 'CloseHandler'})
|
||||||
call assert_equal("run", job_status(job))
|
call assert_equal("run", job_status(job))
|
||||||
try
|
try
|
||||||
call s:waitFor('s:closemsg != 0 && s:outmsg != 0')
|
call s:waitFor('s:closemsg != 0 && s:msg2 != ""')
|
||||||
call assert_equal(1, s:outmsg)
|
call assert_equal('quit', s:msg1)
|
||||||
call assert_equal(2, s:closemsg)
|
call assert_equal('DETACH', s:msg2)
|
||||||
|
call assert_equal(3, s:closemsg)
|
||||||
finally
|
finally
|
||||||
call job_stop(job)
|
call job_stop(job)
|
||||||
delfunc OutHandler
|
delfunc OutHandler
|
||||||
|
@ -753,6 +753,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 */
|
||||||
|
/**/
|
||||||
|
1807,
|
||||||
/**/
|
/**/
|
||||||
1806,
|
1806,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user