Mercurial > vim
diff 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 |
line wrap: on
line diff
--- 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 # if defined(FEAT_GUI) || defined(PROTO) /* @@ -4541,6 +4555,20 @@ channel_select_check(int ret_in, void *r 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;