aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2017-07-24 10:32:07 -0400
committerJames McCoy <jamessan@jamessan.com>2017-07-24 20:10:40 -0400
commit722806a1154a004494ef911c2b77a2f35a8a4a62 (patch)
treeabb899b52305ffb64a0899c3a293776d7fa4f01e
parent58d8d91ec16b9f7eb3ea31ecae73c6c374e9b847 (diff)
downloadrneovim-722806a1154a004494ef911c2b77a2f35a8a4a62.tar.gz
rneovim-722806a1154a004494ef911c2b77a2f35a8a4a62.tar.bz2
rneovim-722806a1154a004494ef911c2b77a2f35a8a4a62.zip
provider: clipboard: Only report stderr if the job failed
Closes #7054
-rw-r--r--runtime/autoload/provider/clipboard.vim15
1 files changed, 8 insertions, 7 deletions
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim
index 86006497d9..8eb694e9fa 100644
--- a/runtime/autoload/provider/clipboard.vim
+++ b/runtime/autoload/provider/clipboard.vim
@@ -6,7 +6,7 @@ let s:paste = {}
" When caching is enabled, store the jobid of the xclip/xsel process keeping
" ownership of the selection, so we know how long the cache is valid.
-let s:selection = { 'owner': 0, 'data': [] }
+let s:selection = { 'owner': 0, 'data': [], 'on_stderr': function('provider#stderr_collector') }
function! s:selection.on_exit(jobid, data, event) abort
" At this point this nvim instance might already have launched
@@ -14,12 +14,13 @@ function! s:selection.on_exit(jobid, data, event) abort
if self.owner == a:jobid
let self.owner = 0
endif
-endfunction
-
-function! s:selection.on_stderr(jobid, data, event) abort
- echohl WarningMsg
- echomsg 'clipboard: error invoking '.get(self.argv, 0, '?').': '.join(a:data)
- echohl None
+ if a:data != 0
+ let stderr = provider#get_stderr(a:jobid)
+ echohl WarningMsg
+ echomsg 'clipboard: error invoking '.get(self.argv, 0, '?').': '.join(stderr)
+ echohl None
+ endif
+ call provider#clear_stderr(a:jobid)
endfunction
let s:selections = { '*': s:selection, '+': copy(s:selection)}