mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.0.0869: job output is sometimes not displayed in a terminal
Problem: Job output is sometimes not displayed in a terminal. Solution: Flush output before closing the channel.
This commit is contained in:
parent
cfcc022c54
commit
a9f028103f
@ -2817,25 +2817,40 @@ channel_close(channel_T *channel, int invoke_close_cb)
|
|||||||
ch_close_part(channel, PART_OUT);
|
ch_close_part(channel, PART_OUT);
|
||||||
ch_close_part(channel, PART_ERR);
|
ch_close_part(channel, PART_ERR);
|
||||||
|
|
||||||
if (invoke_close_cb && channel->ch_close_cb != NULL)
|
if (invoke_close_cb)
|
||||||
|
{
|
||||||
|
ch_part_T part;
|
||||||
|
|
||||||
|
/* Invoke callbacks and flush buffers before the close callback. */
|
||||||
|
if (channel->ch_close_cb != NULL)
|
||||||
|
ch_log(channel,
|
||||||
|
"Invoking callbacks and flushing buffers before closing");
|
||||||
|
for (part = PART_SOCK; part < PART_IN; ++part)
|
||||||
|
{
|
||||||
|
if (channel->ch_close_cb != NULL
|
||||||
|
|| channel->ch_part[part].ch_bufref.br_buf != NULL)
|
||||||
|
{
|
||||||
|
/* Increment the refcount to avoid the channel being freed
|
||||||
|
* halfway. */
|
||||||
|
++channel->ch_refcount;
|
||||||
|
if (channel->ch_close_cb == NULL)
|
||||||
|
ch_log(channel, "flushing %s buffers before closing",
|
||||||
|
part_names[part]);
|
||||||
|
while (may_invoke_callback(channel, part))
|
||||||
|
;
|
||||||
|
--channel->ch_refcount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (channel->ch_close_cb != NULL)
|
||||||
{
|
{
|
||||||
typval_T argv[1];
|
typval_T argv[1];
|
||||||
typval_T rettv;
|
typval_T rettv;
|
||||||
int dummy;
|
int dummy;
|
||||||
ch_part_T part;
|
|
||||||
|
|
||||||
/* Invoke callbacks before the close callback, since it's weird to
|
/* Increment the refcount to avoid the channel being freed
|
||||||
* first invoke the close callback. Increment the refcount to avoid
|
* 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_IN; ++part)
|
|
||||||
while (may_invoke_callback(channel, part))
|
|
||||||
;
|
|
||||||
|
|
||||||
/* Invoke the close callback, if still set. */
|
|
||||||
if (channel->ch_close_cb != NULL)
|
|
||||||
{
|
|
||||||
ch_log(channel, "Invoking close callback %s",
|
ch_log(channel, "Invoking close callback %s",
|
||||||
(char *)channel->ch_close_cb);
|
(char *)channel->ch_close_cb);
|
||||||
argv[0].v_type = VAR_CHANNEL;
|
argv[0].v_type = VAR_CHANNEL;
|
||||||
@ -2845,7 +2860,6 @@ channel_close(channel_T *channel, int invoke_close_cb)
|
|||||||
channel->ch_close_partial, NULL);
|
channel->ch_close_partial, NULL);
|
||||||
clear_tv(&rettv);
|
clear_tv(&rettv);
|
||||||
channel_need_redraw = TRUE;
|
channel_need_redraw = TRUE;
|
||||||
}
|
|
||||||
|
|
||||||
/* the callback is only called once */
|
/* the callback is only called once */
|
||||||
free_callback(channel->ch_close_cb, channel->ch_close_partial);
|
free_callback(channel->ch_close_cb, channel->ch_close_partial);
|
||||||
@ -2865,6 +2879,7 @@ channel_close(channel_T *channel, int invoke_close_cb)
|
|||||||
for (part = PART_SOCK; part < PART_IN; ++part)
|
for (part = PART_SOCK; part < PART_IN; ++part)
|
||||||
drop_messages(channel, part);
|
drop_messages(channel, part);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
channel->ch_nb_close_cb = NULL;
|
channel->ch_nb_close_cb = NULL;
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
* that buffer, attributes come from the scrollback buffer tl_scrollback.
|
* that buffer, attributes come from the scrollback buffer tl_scrollback.
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO:
|
||||||
* - job_start('ls') sometimes does not work.
|
|
||||||
* - MS-Windows: no redraw for 'updatetime' #1915
|
* - MS-Windows: no redraw for 'updatetime' #1915
|
||||||
* - in bash mouse clicks are inserting characters.
|
* - in bash mouse clicks are inserting characters.
|
||||||
* - mouse scroll: when over other window, scroll that window.
|
* - mouse scroll: when over other window, scroll that window.
|
||||||
|
@ -769,6 +769,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 */
|
||||||
|
/**/
|
||||||
|
869,
|
||||||
/**/
|
/**/
|
||||||
868,
|
868,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user