comparison src/channel.c @ 9081:b2b915c1d311 v7.4.1825

commit https://github.com/vim/vim/commit/5d96e3ae534ade8ed09a5de9ff8fd7519537ec28 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 8 21:47:01 2016 +0200 patch 7.4.1825 Problem: When job writes to buffer nothing is written. (Nicola) Solution: Do not discard a channel before writing is done.
author Christian Brabandt <cb@256bit.org>
date Sun, 08 May 2016 22:00:06 +0200
parents 2cd83c854073
children 69bb7b230094
comparison
equal deleted inserted replaced
9080:af3def158d85 9081:b2b915c1d311
350 350
351 /* If there is a close callback it may still need to be invoked. */ 351 /* If there is a close callback it may still need to be invoked. */
352 if (channel->ch_close_cb != NULL) 352 if (channel->ch_close_cb != NULL)
353 return TRUE; 353 return TRUE;
354 354
355 /* If reading from or a buffer it's still useful. */
356 if (channel->ch_part[PART_IN].ch_buffer != NULL)
357 return TRUE;
358
355 /* If there is no callback then nobody can get readahead. If the fd is 359 /* If there is no callback then nobody can get readahead. If the fd is
356 * closed and there is no readahead then the callback won't be called. */ 360 * closed and there is no readahead then the callback won't be called. */
357 has_sock_msg = channel->ch_part[PART_SOCK].ch_fd != INVALID_FD 361 has_sock_msg = channel->ch_part[PART_SOCK].ch_fd != INVALID_FD
358 || channel->ch_part[PART_SOCK].ch_head.rq_next != NULL 362 || channel->ch_part[PART_SOCK].ch_head.rq_next != NULL
359 || channel->ch_part[PART_SOCK].ch_json_head.jq_next != NULL; 363 || channel->ch_part[PART_SOCK].ch_json_head.jq_next != NULL;
363 has_err_msg = channel->ch_part[PART_ERR].ch_fd != INVALID_FD 367 has_err_msg = channel->ch_part[PART_ERR].ch_fd != INVALID_FD
364 || channel->ch_part[PART_ERR].ch_head.rq_next != NULL 368 || channel->ch_part[PART_ERR].ch_head.rq_next != NULL
365 || channel->ch_part[PART_ERR].ch_json_head.jq_next != NULL; 369 || channel->ch_part[PART_ERR].ch_json_head.jq_next != NULL;
366 return (channel->ch_callback != NULL && (has_sock_msg 370 return (channel->ch_callback != NULL && (has_sock_msg
367 || has_out_msg || has_err_msg)) 371 || has_out_msg || has_err_msg))
368 || (channel->ch_part[PART_OUT].ch_callback != NULL && has_out_msg) 372 || ((channel->ch_part[PART_OUT].ch_callback != NULL
369 || (channel->ch_part[PART_ERR].ch_callback != NULL && has_err_msg); 373 || channel->ch_part[PART_OUT].ch_buffer) && has_out_msg)
374 || ((channel->ch_part[PART_ERR].ch_callback != NULL
375 || channel->ch_part[PART_ERR].ch_buffer) && has_err_msg);
370 } 376 }
371 377
372 /* 378 /*
373 * Close a channel and free all its resources. 379 * Close a channel and free all its resources.
374 */ 380 */