fix(clipboard): ignore exit caused by signal #23378

Problem:
If clipboard job exits by signal, the exit code is >=128:
939d9053bd
xclip 0.13 often exits with code 143, which spams unhelpful messages:

    clipboard: error invoking xclip: Waiting for selection requests,
    Control-C to quit   Waiting for selection request number 1

Solution:
Don't show a warning if the clipboard tool exit code is >=128.
Fixes: #7054
This commit is contained in:
Kai Ting 2023-07-16 04:15:30 -07:00 committed by GitHub
parent 047c22a28c
commit c3de6524a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,7 +25,8 @@ function! s:selection.on_exit(jobid, data, event) abort
if self.owner == a:jobid if self.owner == a:jobid
let self.owner = 0 let self.owner = 0
endif endif
if a:data != 0 " Don't print if exit code is >= 128 ( exit is 128+SIGNUM if by signal (e.g. 143 on SIGTERM))
if a:data > 0 && a:data < 128
echohl WarningMsg echohl WarningMsg
echomsg 'clipboard: error invoking '.get(self.argv, 0, '?').': '.join(self.stderr) echomsg 'clipboard: error invoking '.get(self.argv, 0, '?').': '.join(self.stderr)
echohl None echohl None