Mercurial > vim
comparison src/terminal.c @ 11727:cb1dc90d22cc v8.0.0746
patch 8.0.0746: when :term fails the job is not properly cleaned up
commit https://github.com/vim/vim/commit/61a6605ea1201eb49a126ca696fcfc56caf5dca6
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jul 22 18:39:00 2017 +0200
patch 8.0.0746: when :term fails the job is not properly cleaned up
Problem: When :term fails the job is not properly cleaned up.
Solution: Free the terminal. Handle a job that failed to start. (closes
#1858)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 22 Jul 2017 18:45:04 +0200 |
parents | 22cef8face93 |
children | 1c8ec1029233 |
comparison
equal
deleted
inserted
replaced
11726:a18dff800264 | 11727:cb1dc90d22cc |
---|---|
201 /* store the size we ended up with */ | 201 /* store the size we ended up with */ |
202 vterm_get_size(term->tl_vterm, &term->tl_rows, &term->tl_cols); | 202 vterm_get_size(term->tl_vterm, &term->tl_rows, &term->tl_cols); |
203 } | 203 } |
204 else | 204 else |
205 { | 205 { |
206 free_terminal(term); | |
207 curbuf->b_term = NULL; | |
208 | |
206 /* Wiping out the buffer will also close the window and call | 209 /* Wiping out the buffer will also close the window and call |
207 * free_terminal(). */ | 210 * free_terminal(). */ |
208 do_buffer(DOBUF_WIPE, DOBUF_CURRENT, FORWARD, 0, TRUE); | 211 do_buffer(DOBUF_WIPE, DOBUF_CURRENT, FORWARD, 0, TRUE); |
209 } | 212 } |
210 | 213 |
233 break; | 236 break; |
234 } | 237 } |
235 | 238 |
236 if (term->tl_job != NULL) | 239 if (term->tl_job != NULL) |
237 { | 240 { |
238 if (term->tl_job->jv_status != JOB_ENDED) | 241 if (term->tl_job->jv_status != JOB_ENDED |
242 && term->tl_job->jv_status != JOB_FAILED) | |
239 job_stop(term->tl_job, NULL, "kill"); | 243 job_stop(term->tl_job, NULL, "kill"); |
240 job_unref(term->tl_job); | 244 job_unref(term->tl_job); |
241 } | 245 } |
242 | 246 |
243 term_free(term); | 247 term_free(term); |
939 argvars[0].v_type = VAR_STRING; | 943 argvars[0].v_type = VAR_STRING; |
940 argvars[0].vval.v_string = cmd; | 944 argvars[0].vval.v_string = cmd; |
941 setup_job_options(&opt, rows, cols); | 945 setup_job_options(&opt, rows, cols); |
942 term->tl_job = job_start(argvars, &opt); | 946 term->tl_job = job_start(argvars, &opt); |
943 | 947 |
944 return term->tl_job != NULL ? OK : FAIL; | 948 return term->tl_job != NULL |
949 && term->tl_job->jv_channel != NULL | |
950 && term->tl_job->jv_status != JOB_FAILED ? OK : FAIL; | |
945 } | 951 } |
946 | 952 |
947 /* | 953 /* |
948 * Free the terminal emulator part of "term". | 954 * Free the terminal emulator part of "term". |
949 */ | 955 */ |