comparison src/channel.c @ 11670:3b2afa2b77b3 v8.0.0718

patch 8.0.0718: output of job in terminal is not displayed commit https://github.com/vim/vim/commit/cb8bbe9bf3214d07580d6b43d6539416884153bd Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 16 13:48:22 2017 +0200 patch 8.0.0718: output of job in terminal is not displayed Problem: Output of job in terminal is not displayed. Solution: Connect the job output to the terminal.
author Christian Brabandt <cb@256bit.org>
date Sun, 16 Jul 2017 14:00:03 +0200
parents 5cd9ba96561d
children 3c6cc2f24645
comparison
equal deleted inserted replaced
11669:20bedd70c837 11670:3b2afa2b77b3
169 fflush(log_fd); 169 fflush(log_fd);
170 did_log_msg = TRUE; 170 did_log_msg = TRUE;
171 } 171 }
172 } 172 }
173 173
174 static void 174 void
175 ch_logn(channel_T *ch, char *msg, int nr) 175 ch_logn(channel_T *ch, char *msg, int nr)
176 { 176 {
177 if (log_fd != NULL) 177 if (log_fd != NULL)
178 { 178 {
179 ch_log_lead("", ch); 179 ch_log_lead("", ch);
2654 { 2654 {
2655 if (msg == NULL) 2655 if (msg == NULL)
2656 /* JSON or JS mode: re-encode the message. */ 2656 /* JSON or JS mode: re-encode the message. */
2657 msg = json_encode(listtv, ch_mode); 2657 msg = json_encode(listtv, ch_mode);
2658 if (msg != NULL) 2658 if (msg != NULL)
2659 append_to_buffer(buffer, msg, channel, part); 2659 {
2660 if (buffer->b_term != NULL)
2661 write_to_term(buffer, msg, channel);
2662 else
2663 append_to_buffer(buffer, msg, channel, part);
2664 }
2660 } 2665 }
2661 2666
2662 if (callback != NULL) 2667 if (callback != NULL)
2663 { 2668 {
2664 if (cbitem != NULL) 2669 if (cbitem != NULL)
4887 4892
4888 /* 4893 /*
4889 * "job_start()" function 4894 * "job_start()" function
4890 */ 4895 */
4891 job_T * 4896 job_T *
4892 job_start(typval_T *argvars) 4897 job_start(typval_T *argvars, jobopt_T *opt_arg)
4893 { 4898 {
4894 job_T *job; 4899 job_T *job;
4895 char_u *cmd = NULL; 4900 char_u *cmd = NULL;
4896 #if defined(UNIX) 4901 #if defined(UNIX)
4897 # define USE_ARGV 4902 # define USE_ARGV
4910 job->jv_status = JOB_FAILED; 4915 job->jv_status = JOB_FAILED;
4911 #ifndef USE_ARGV 4916 #ifndef USE_ARGV
4912 ga_init2(&ga, (int)sizeof(char*), 20); 4917 ga_init2(&ga, (int)sizeof(char*), 20);
4913 #endif 4918 #endif
4914 4919
4915 /* Default mode is NL. */ 4920 if (opt_arg != NULL)
4916 clear_job_options(&opt); 4921 opt = *opt_arg;
4917 opt.jo_mode = MODE_NL; 4922 else
4918 if (get_job_options(&argvars[1], &opt, 4923 {
4924 /* Default mode is NL. */
4925 clear_job_options(&opt);
4926 opt.jo_mode = MODE_NL;
4927 if (get_job_options(&argvars[1], &opt,
4919 JO_MODE_ALL + JO_CB_ALL + JO_TIMEOUT_ALL + JO_STOPONEXIT 4928 JO_MODE_ALL + JO_CB_ALL + JO_TIMEOUT_ALL + JO_STOPONEXIT
4920 + JO_EXIT_CB + JO_OUT_IO + JO_BLOCK_WRITE) == FAIL) 4929 + JO_EXIT_CB + JO_OUT_IO + JO_BLOCK_WRITE) == FAIL)
4921 goto theend; 4930 goto theend;
4931 }
4922 4932
4923 /* Check that when io is "file" that there is a file name. */ 4933 /* Check that when io is "file" that there is a file name. */
4924 for (part = PART_OUT; part < PART_COUNT; ++part) 4934 for (part = PART_OUT; part < PART_COUNT; ++part)
4925 if ((opt.jo_set & (JO_OUT_IO << (part - PART_OUT))) 4935 if ((opt.jo_set & (JO_OUT_IO << (part - PART_OUT)))
4926 && opt.jo_io[part] == JIO_FILE 4936 && opt.jo_io[part] == JIO_FILE