comparison src/terminal.c @ 12415:cd66083e371e v8.0.1087

patch 8.0.1087: Test_terminal_cwd is flaky commit https://github.com/vim/vim/commit/e9f6fd27d0e2dcae3f4aa40c459d5e6a3b3dd102 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Sep 10 14:25:49 2017 +0200 patch 8.0.1087: Test_terminal_cwd is flaky Problem: Test_terminal_cwd is flaky. MS-Windows: term_start() "cwd" argument does not work. Solution: Wait for the condition to be true instead of using a sleep. Pass the directory to winpty.
author Christian Brabandt <cb@256bit.org>
date Sun, 10 Sep 2017 14:30:03 +0200
parents eb8d5c4936f1
children 735b49ff8fbb
comparison
equal deleted inserted replaced
12414:46622370ce1e 12415:cd66083e371e
36 * that buffer, attributes come from the scrollback buffer tl_scrollback. 36 * that buffer, attributes come from the scrollback buffer tl_scrollback.
37 * When the buffer is changed it is turned into a normal buffer, the attributes 37 * When the buffer is changed it is turned into a normal buffer, the attributes
38 * in tl_scrollback are no longer used. 38 * in tl_scrollback are no longer used.
39 * 39 *
40 * TODO: 40 * TODO:
41 * - check for memory leaks
42 * - patch to use GUI or cterm colors for vterm. Yasuhiro, #2067 41 * - patch to use GUI or cterm colors for vterm. Yasuhiro, #2067
42 * - when Normal background is not white or black, going to Terminal-Normal
43 * mode does not clear correctly. Use the terminal background color to erase
44 * the background.
45 * - patch to add tmap, jakalope (Jacob Askeland) #2073
43 * - Redirecting output does not work on MS-Windows. 46 * - Redirecting output does not work on MS-Windows.
44 * - implement term_setsize() 47 * - implement term_setsize()
45 * - add test for giving error for invalid 'termsize' value. 48 * - add test for giving error for invalid 'termsize' value.
46 * - support minimal size when 'termsize' is "rows*cols". 49 * - support minimal size when 'termsize' is "rows*cols".
47 * - support minimal size when 'termsize' is empty? 50 * - support minimal size when 'termsize' is empty?
3097 term_T *term, 3100 term_T *term,
3098 typval_T *argvar, 3101 typval_T *argvar,
3099 jobopt_T *opt) 3102 jobopt_T *opt)
3100 { 3103 {
3101 WCHAR *cmd_wchar = NULL; 3104 WCHAR *cmd_wchar = NULL;
3105 WCHAR *cwd_wchar = NULL;
3102 channel_T *channel = NULL; 3106 channel_T *channel = NULL;
3103 job_T *job = NULL; 3107 job_T *job = NULL;
3104 DWORD error; 3108 DWORD error;
3105 HANDLE jo = NULL; 3109 HANDLE jo = NULL;
3106 HANDLE child_process_handle; 3110 HANDLE child_process_handle;
3124 } 3128 }
3125 3129
3126 cmd_wchar = enc_to_utf16(cmd, NULL); 3130 cmd_wchar = enc_to_utf16(cmd, NULL);
3127 if (cmd_wchar == NULL) 3131 if (cmd_wchar == NULL)
3128 return FAIL; 3132 return FAIL;
3133 if (opt->jo_cwd != NULL)
3134 cwd_wchar = enc_to_utf16(opt->jo_cwd, NULL);
3129 3135
3130 job = job_alloc(); 3136 job = job_alloc();
3131 if (job == NULL) 3137 if (job == NULL)
3132 goto failed; 3138 goto failed;
3133 3139
3150 spawn_config = winpty_spawn_config_new( 3156 spawn_config = winpty_spawn_config_new(
3151 WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN | 3157 WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN |
3152 WINPTY_SPAWN_FLAG_EXIT_AFTER_SHUTDOWN, 3158 WINPTY_SPAWN_FLAG_EXIT_AFTER_SHUTDOWN,
3153 NULL, 3159 NULL,
3154 cmd_wchar, 3160 cmd_wchar,
3155 NULL, 3161 cwd_wchar,
3156 NULL, 3162 NULL,
3157 &winpty_err); 3163 &winpty_err);
3158 if (spawn_config == NULL) 3164 if (spawn_config == NULL)
3159 goto failed; 3165 goto failed;
3160 3166
3201 jo = NULL; 3207 jo = NULL;
3202 } 3208 }
3203 3209
3204 winpty_spawn_config_free(spawn_config); 3210 winpty_spawn_config_free(spawn_config);
3205 vim_free(cmd_wchar); 3211 vim_free(cmd_wchar);
3212 vim_free(cwd_wchar);
3206 3213
3207 create_vterm(term, term->tl_rows, term->tl_cols); 3214 create_vterm(term, term->tl_rows, term->tl_cols);
3208 3215
3209 channel_set_job(channel, job, opt); 3216 channel_set_job(channel, job, opt);
3210 job_set_options(job, opt); 3217 job_set_options(job, opt);
3224 return OK; 3231 return OK;
3225 3232
3226 failed: 3233 failed:
3227 if (argvar->v_type == VAR_LIST) 3234 if (argvar->v_type == VAR_LIST)
3228 vim_free(ga.ga_data); 3235 vim_free(ga.ga_data);
3229 if (cmd_wchar != NULL) 3236 vim_free(cmd_wchar);
3230 vim_free(cmd_wchar); 3237 vim_free(cwd_wchar);
3231 if (spawn_config != NULL) 3238 if (spawn_config != NULL)
3232 winpty_spawn_config_free(spawn_config); 3239 winpty_spawn_config_free(spawn_config);
3233 if (channel != NULL) 3240 if (channel != NULL)
3234 channel_clear(channel); 3241 channel_clear(channel);
3235 if (job != NULL) 3242 if (job != NULL)