diff options
author | Daniel Hahler <git@thequod.de> | 2019-08-14 09:58:52 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-08-14 09:58:52 +0200 |
commit | 2fafed6bb8aa316861173c39a89d0c9cca6cd4d9 (patch) | |
tree | 4407664ae5d10e4388b927091715ef14a6ee14ec | |
parent | 8fda095b6d82490adf550d22af9d4af767789129 (diff) | |
download | rneovim-2fafed6bb8aa316861173c39a89d0c9cca6cd4d9.tar.gz rneovim-2fafed6bb8aa316861173c39a89d0c9cca6cd4d9.tar.bz2 rneovim-2fafed6bb8aa316861173c39a89d0c9cca6cd4d9.zip |
clipboard: handle/avoid SIGTERM with previous owner #10765
Fixes regression due to signal being reported with exit status.
ref #10573 939d9053bdf2f56
ref https://github.com/neovim/neovim/issues/7054#issuecomment-520282429
-rw-r--r-- | runtime/autoload/provider/clipboard.vim | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim index ce140b0948..e33dc31f6d 100644 --- a/runtime/autoload/provider/clipboard.vim +++ b/runtime/autoload/provider/clipboard.vim @@ -159,9 +159,7 @@ function! s:clipboard.set(lines, regtype, reg) abort end if s:selections[a:reg].owner > 0 - " The previous provider instance should exit when the new one takes - " ownership, but kill it to be sure we don't fill up the job table. - call jobstop(s:selections[a:reg].owner) + let prev_job = s:selections[a:reg].owner end let s:selections[a:reg] = copy(s:selection) let selection = s:selections[a:reg] @@ -175,13 +173,23 @@ function! s:clipboard.set(lines, regtype, reg) abort call jobsend(jobid, a:lines) call jobclose(jobid, 'stdin') let selection.owner = jobid + let ret = 1 else echohl WarningMsg echomsg 'clipboard: failed to execute: '.(s:copy[a:reg]) echohl None - return 0 + let ret = 1 + endif + + " The previous provider instance should exit when the new one takes + " ownership, but kill it to be sure we don't fill up the job table. + if exists('prev_job') + call timer_start(1000, {... -> + \ jobwait([prev_job], 0)[0] == -1 + \ && jobstop(prev_job)}) endif - return 1 + + return ret endfunction function! provider#clipboard#Call(method, args) abort |