Mercurial > vim
comparison src/channel.c @ 20277:8a694c9447d7 v8.2.0694
patch 8.2.0694: Haiku: channel and terminal do not work
Commit: https://github.com/vim/vim/commit/80a8d3889bf1341c47f1c88c59825f183b2b4753
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 3 22:57:32 2020 +0200
patch 8.2.0694: Haiku: channel and terminal do not work
Problem: Haiku: channel and terminal do not work.
Solution: Close files when the job has finished. (Ozaki Kiichi,
closes #6039)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 03 May 2020 23:00:04 +0200 |
parents | 456c3b98d4c8 |
children | ad6949eaa1c7 |
comparison
equal
deleted
inserted
replaced
20276:36edcb98d341 | 20277:8a694c9447d7 |
---|---|
3938 | 3938 |
3939 theend: | 3939 theend: |
3940 free_job_options(&opt); | 3940 free_job_options(&opt); |
3941 } | 3941 } |
3942 | 3942 |
3943 # if defined(MSWIN) || defined(FEAT_GUI) || defined(PROTO) | 3943 #if defined(MSWIN) || defined(__HAIKU__) || defined(FEAT_GUI) || defined(PROTO) |
3944 /* | 3944 /* |
3945 * Check the channels for anything that is ready to be read. | 3945 * Check the channels for anything that is ready to be read. |
3946 * The data is put in the read queue. | 3946 * The data is put in the read queue. |
3947 * if "only_keep_open" is TRUE only check channels where ch_keep_open is set. | 3947 * if "only_keep_open" is TRUE only check channels where ch_keep_open is set. |
3948 */ | 3948 */ |
3971 else if (r == CW_ERROR) | 3971 else if (r == CW_ERROR) |
3972 ch_close_part_on_error(channel, part, TRUE, | 3972 ch_close_part_on_error(channel, part, TRUE, |
3973 "channel_handle_events"); | 3973 "channel_handle_events"); |
3974 } | 3974 } |
3975 } | 3975 } |
3976 } | 3976 |
3977 } | 3977 # ifdef __HAIKU__ |
3978 // Workaround for Haiku: Since select/poll cannot detect EOF from tty, | |
3979 // should close fds when the job has finished if 'channel' connects to | |
3980 // the pty. | |
3981 if (channel->ch_job != NULL) | |
3982 { | |
3983 job_T *job = channel->ch_job; | |
3984 | |
3985 if (job->jv_tty_out != NULL && job->jv_status == JOB_FINISHED) | |
3986 for (part = PART_SOCK; part < PART_COUNT; ++part) | |
3987 ch_close_part(channel, part); | |
3988 } | |
3978 # endif | 3989 # endif |
3990 } | |
3991 } | |
3992 #endif | |
3979 | 3993 |
3980 # if defined(FEAT_GUI) || defined(PROTO) | 3994 # if defined(FEAT_GUI) || defined(PROTO) |
3981 /* | 3995 /* |
3982 * Return TRUE when there is any channel with a keep_open flag. | 3996 * Return TRUE when there is any channel with a keep_open flag. |
3983 */ | 3997 */ |
4539 // Clear the flag first, ch_fd may change in channel_write_input(). | 4553 // Clear the flag first, ch_fd may change in channel_write_input(). |
4540 FD_CLR(in_part->ch_fd, wfds); | 4554 FD_CLR(in_part->ch_fd, wfds); |
4541 channel_write_input(channel); | 4555 channel_write_input(channel); |
4542 --ret; | 4556 --ret; |
4543 } | 4557 } |
4558 | |
4559 # ifdef __HAIKU__ | |
4560 // Workaround for Haiku: Since select/poll cannot detect EOF from tty, | |
4561 // should close fds when the job has finished if 'channel' connects to | |
4562 // the pty. | |
4563 if (channel->ch_job != NULL) | |
4564 { | |
4565 job_T *job = channel->ch_job; | |
4566 | |
4567 if (job->jv_tty_out != NULL && job->jv_status == JOB_FINISHED) | |
4568 for (part = PART_SOCK; part < PART_COUNT; ++part) | |
4569 ch_close_part(channel, part); | |
4570 } | |
4571 # endif | |
4544 } | 4572 } |
4545 | 4573 |
4546 return ret; | 4574 return ret; |
4547 } | 4575 } |
4548 #endif // !MSWIN && HAVE_SELECT | 4576 #endif // !MSWIN && HAVE_SELECT |