0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 7.4.2297

Problem:    When starting a job that reads from a buffer and reaching the end,
            the job hangs.
Solution:   Close the pipe or socket when all lines were read.
This commit is contained in:
Bram Moolenaar
2016-09-01 14:35:22 +02:00
parent f37506f60f
commit d8b554904d
3 changed files with 46 additions and 1 deletions

View File

@@ -1424,11 +1424,14 @@ channel_write_in(channel_T *channel)
ch_logn(channel, "written %d lines to channel", written);
in_part->ch_buf_top = lnum;
if (lnum > buf->b_ml.ml_line_count)
if (lnum > buf->b_ml.ml_line_count || lnum > in_part->ch_buf_bot)
{
/* Writing is done, no longer need the buffer. */
in_part->ch_bufref.br_buf = NULL;
ch_log(channel, "Finished writing all lines to channel");
/* Close the pipe/socket, so that the other side gets EOF. */
may_close_part(&channel->CH_IN_FD);
}
else
ch_logn(channel, "Still %d more lines to write",