diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2021-08-31 07:24:25 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-31 07:24:25 -0700 |
commit | 284199bc4bf36bb74c481da9c8b2a43c1bbbeb51 (patch) | |
tree | 336bf2b82126e5efa3d6f149d4a6026ef1a24d54 /src/nvim/eval | |
parent | 9695691ee4868ea9fdd8a6d84b9980fc22c77aa3 (diff) | |
parent | 3c081d028062f793b63b8689f854bbea30e15752 (diff) | |
download | rneovim-284199bc4bf36bb74c481da9c8b2a43c1bbbeb51.tar.gz rneovim-284199bc4bf36bb74c481da9c8b2a43c1bbbeb51.tar.bz2 rneovim-284199bc4bf36bb74c481da9c8b2a43c1bbbeb51.zip |
Merge #15402 fix(terminal): close without ! if the job is stopped
Diffstat (limited to 'src/nvim/eval')
-rw-r--r-- | src/nvim/eval/funcs.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 8a1258efd4..99f9f17e0a 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -5404,14 +5404,19 @@ static void f_jobwait(typval_T *argvars, typval_T *rettv, FunPtr fptr) TV_LIST_ITER_CONST(args, arg, { Channel *chan = NULL; if (TV_LIST_ITEM_TV(arg)->v_type != VAR_NUMBER - || !(chan = find_job(TV_LIST_ITEM_TV(arg)->vval.v_number, false))) { + || !(chan = find_channel(TV_LIST_ITEM_TV(arg)->vval.v_number)) + || chan->streamtype != kChannelStreamProc) { + jobs[i] = NULL; // Invalid job. + } else if (process_is_stopped(&chan->stream.proc)) { + // Job is stopped but not fully destroyed. + // Ensure all callbacks on its event queue are executed. #15402 + process_wait(&chan->stream.proc, -1, NULL); jobs[i] = NULL; // Invalid job. } else { jobs[i] = chan; channel_incref(chan); if (chan->stream.proc.status < 0) { - // Process any pending events on the job's queue before temporarily - // replacing it. + // Flush any events in the job's queue before temporarily replacing it. multiqueue_process_events(chan->events); multiqueue_replace_parent(chan->events, waiting_jobs); } |