aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-08-14 09:58:52 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-08-14 09:58:52 +0200
commit2fafed6bb8aa316861173c39a89d0c9cca6cd4d9 (patch)
tree4407664ae5d10e4388b927091715ef14a6ee14ec
parent8fda095b6d82490adf550d22af9d4af767789129 (diff)
downloadrneovim-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.vim18
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