diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-05-03 22:57:32 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-05-03 22:57:32 +0200 |
commit | 80a8d3889bf1341c47f1c88c59825f183b2b4753 (patch) | |
tree | 09cf69c6e3dc3f8513badc8ec99dd593ceb7842d /src/channel.c | |
parent | 2fd4cd755c3e87e733b7363ac13e5c0fe0297a80 (diff) | |
download | vim-git-80a8d3889bf1341c47f1c88c59825f183b2b4753.tar.gz |
patch 8.2.0694: Haiku: channel and terminal do not workv8.2.0694
Problem: Haiku: channel and terminal do not work.
Solution: Close files when the job has finished. (Ozaki Kiichi,
closes #6039)
Diffstat (limited to 'src/channel.c')
-rw-r--r-- | src/channel.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/channel.c b/src/channel.c index 68ac4bc29..2234ad5d5 100644 --- a/src/channel.c +++ b/src/channel.c @@ -3940,7 +3940,7 @@ theend: free_job_options(&opt); } -# if defined(MSWIN) || defined(FEAT_GUI) || defined(PROTO) +#if defined(MSWIN) || defined(__HAIKU__) || defined(FEAT_GUI) || defined(PROTO) /* * Check the channels for anything that is ready to be read. * The data is put in the read queue. @@ -3973,9 +3973,23 @@ channel_handle_events(int only_keep_open) "channel_handle_events"); } } + +# ifdef __HAIKU__ + // Workaround for Haiku: Since select/poll cannot detect EOF from tty, + // should close fds when the job has finished if 'channel' connects to + // the pty. + if (channel->ch_job != NULL) + { + job_T *job = channel->ch_job; + + if (job->jv_tty_out != NULL && job->jv_status == JOB_FINISHED) + for (part = PART_SOCK; part < PART_COUNT; ++part) + ch_close_part(channel, part); + } +# endif } } -# endif +#endif # if defined(FEAT_GUI) || defined(PROTO) /* @@ -4541,6 +4555,20 @@ channel_select_check(int ret_in, void *rfds_in, void *wfds_in) channel_write_input(channel); --ret; } + +# ifdef __HAIKU__ + // Workaround for Haiku: Since select/poll cannot detect EOF from tty, + // should close fds when the job has finished if 'channel' connects to + // the pty. + if (channel->ch_job != NULL) + { + job_T *job = channel->ch_job; + + if (job->jv_tty_out != NULL && job->jv_status == JOB_FINISHED) + for (part = PART_SOCK; part < PART_COUNT; ++part) + ch_close_part(channel, part); + } +# endif } return ret; |