Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

clipboard: handle/avoid SIGTERM with previous owner #10765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions 18 runtime/autoload/provider/clipboard.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.