From 2fd15e7c6c09f11b8aeeb5c972b29cdf99070cf9 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Wed, 25 Apr 2018 23:10:58 +0200 Subject: [PATCH] Silence xsel errors Fixes #4923. [ci skip] --- share/functions/fish_clipboard_copy.fish | 4 +++- share/functions/fish_clipboard_paste.fish | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/share/functions/fish_clipboard_copy.fish b/share/functions/fish_clipboard_copy.fish index a973e4437..b747799ca 100644 --- a/share/functions/fish_clipboard_copy.fish +++ b/share/functions/fish_clipboard_copy.fish @@ -2,6 +2,8 @@ function fish_clipboard_copy if type -q pbcopy commandline | pbcopy else if type -q xsel - commandline | xsel --clipboard + # Silence error so no error message shows up + # if e.g. X isn't running. + commandline | xsel --clipboard 2>/dev/null end end diff --git a/share/functions/fish_clipboard_paste.fish b/share/functions/fish_clipboard_paste.fish index 232a0a80a..f82c56e57 100644 --- a/share/functions/fish_clipboard_paste.fish +++ b/share/functions/fish_clipboard_paste.fish @@ -4,10 +4,9 @@ function fish_clipboard_paste set data (pbpaste) else if type -q xsel # Return if `xsel` failed. - # That way any xsel error is printed (to show e.g. a non-functioning X connection), - # but we don't print the redundant (and overly verbose for this) commandline error. + # That way we don't print the redundant (and overly verbose for this) commandline error. # Also require non-empty contents to not clear the buffer. - if not set data (xsel --clipboard) + if not set data (xsel --clipboard 2>/dev/null) return 1 end end