Mercurial > vim
comparison src/channel.c @ 15160:ec67c6b8ef12 v8.1.0590
patch 8.1.0590: when a job ends the closed channels are not handled
commit https://github.com/vim/vim/commit/cd1a62d468a55aca68deb3139d83530c7c23568d
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Dec 14 21:32:02 2018 +0100
patch 8.1.0590: when a job ends the closed channels are not handled
Problem: When a job ends the closed channels are not handled.
Solution: When a job is detected to have ended, check the channels again.
(closes #3530)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 14 Dec 2018 21:45:05 +0100 |
parents | 6783403ff35e |
children | de63593896b3 |
comparison
equal
deleted
inserted
replaced
15159:9fad1f9e15b2 | 15160:ec67c6b8ef12 |
---|---|
5508 | 5508 |
5509 #define MAX_CHECK_ENDED 8 | 5509 #define MAX_CHECK_ENDED 8 |
5510 | 5510 |
5511 /* | 5511 /* |
5512 * Called once in a while: check if any jobs that seem useful have ended. | 5512 * Called once in a while: check if any jobs that seem useful have ended. |
5513 */ | 5513 * Returns TRUE if a job did end. |
5514 void | 5514 */ |
5515 int | |
5515 job_check_ended(void) | 5516 job_check_ended(void) |
5516 { | 5517 { |
5517 int i; | 5518 int i; |
5518 | 5519 int did_end = FALSE; |
5520 | |
5521 // be quick if there are no jobs to check | |
5519 if (first_job == NULL) | 5522 if (first_job == NULL) |
5520 return; | 5523 return did_end; |
5521 | 5524 |
5522 for (i = 0; i < MAX_CHECK_ENDED; ++i) | 5525 for (i = 0; i < MAX_CHECK_ENDED; ++i) |
5523 { | 5526 { |
5524 /* NOTE: mch_detect_ended_job() must only return a job of which the | 5527 // NOTE: mch_detect_ended_job() must only return a job of which the |
5525 * status was just set to JOB_ENDED. */ | 5528 // status was just set to JOB_ENDED. |
5526 job_T *job = mch_detect_ended_job(first_job); | 5529 job_T *job = mch_detect_ended_job(first_job); |
5527 | 5530 |
5528 if (job == NULL) | 5531 if (job == NULL) |
5529 break; | 5532 break; |
5530 job_cleanup(job); /* may free "job" */ | 5533 did_end = TRUE; |
5534 job_cleanup(job); // may free "job" | |
5531 } | 5535 } |
5532 | 5536 |
5533 if (channel_need_redraw) | 5537 if (channel_need_redraw) |
5534 { | 5538 { |
5535 channel_need_redraw = FALSE; | 5539 channel_need_redraw = FALSE; |
5536 redraw_after_callback(TRUE); | 5540 redraw_after_callback(TRUE); |
5537 } | 5541 } |
5542 return did_end; | |
5538 } | 5543 } |
5539 | 5544 |
5540 /* | 5545 /* |
5541 * Create a job and return it. Implements job_start(). | 5546 * Create a job and return it. Implements job_start(). |
5542 * "argv_arg" is only for Unix. | 5547 * "argv_arg" is only for Unix. |