comparison src/channel.c @ 10052:c1ba49441c90 v7.4.2297

commit https://github.com/vim/vim/commit/d8b554904d18fe19bd9fa79dbda880845cb017d2 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 1 14:35:22 2016 +0200 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.
author Christian Brabandt <cb@256bit.org>
date Thu, 01 Sep 2016 14:45:06 +0200
parents 4aead6a9b7a9
children d4b7232fc63a
comparison
equal deleted inserted replaced
10051:46763b01cd9a 10052:c1ba49441c90
1422 ch_logn(channel, "written line %d to channel", (int)lnum - 1); 1422 ch_logn(channel, "written line %d to channel", (int)lnum - 1);
1423 else if (written > 1) 1423 else if (written > 1)
1424 ch_logn(channel, "written %d lines to channel", written); 1424 ch_logn(channel, "written %d lines to channel", written);
1425 1425
1426 in_part->ch_buf_top = lnum; 1426 in_part->ch_buf_top = lnum;
1427 if (lnum > buf->b_ml.ml_line_count) 1427 if (lnum > buf->b_ml.ml_line_count || lnum > in_part->ch_buf_bot)
1428 { 1428 {
1429 /* Writing is done, no longer need the buffer. */ 1429 /* Writing is done, no longer need the buffer. */
1430 in_part->ch_bufref.br_buf = NULL; 1430 in_part->ch_bufref.br_buf = NULL;
1431 ch_log(channel, "Finished writing all lines to channel"); 1431 ch_log(channel, "Finished writing all lines to channel");
1432
1433 /* Close the pipe/socket, so that the other side gets EOF. */
1434 may_close_part(&channel->CH_IN_FD);
1432 } 1435 }
1433 else 1436 else
1434 ch_logn(channel, "Still %d more lines to write", 1437 ch_logn(channel, "Still %d more lines to write",
1435 buf->b_ml.ml_line_count - lnum + 1); 1438 buf->b_ml.ml_line_count - lnum + 1);
1436 } 1439 }