Always send xsel logfile to /dev/null

We don't want this logging to disk, but /dev/stderr doesn't always work
(see #81). Let's just stop all logging to avoid more shenanigans.
This commit is contained in:
Chris Down 2018-05-10 17:13:46 +01:00
parent f3badd8f35
commit 4a3862666f
3 changed files with 4 additions and 15 deletions

View file

@ -68,5 +68,5 @@ if ! [[ -f "$file" ]]; then
fi fi
for selection in clipboard primary; do for selection in clipboard primary; do
xsel --logfile /dev/stderr -i --"$selection" < "$file" xsel --logfile /dev/null -i --"$selection" < "$file"
done done

View file

@ -21,19 +21,8 @@ has_clipnotify=0
# shellcheck disable=SC2206 # shellcheck disable=SC2206
cm_selections=( $CM_SELECTIONS ) cm_selections=( $CM_SELECTIONS )
xsel_log=/dev/null
for file in /proc/self/fd/2 /dev/stderr; do
[[ -f "$file" ]] || continue
# In Linux, it's not possible to write to a socket represented by a file
# (for example, /dev/stderr or /proc/self/fd/2). See issue #54.
[[ -f "$(readlink -m "$file")" ]] || continue
xsel_log="$file"
break
done
_xsel() { _xsel() {
timeout 1 xsel --logfile "$xsel_log" "$@" timeout 1 xsel --logfile /dev/null "$@"
} }
get_first_line() { get_first_line() {

View file

@ -81,8 +81,8 @@ grep -Fxq 'dmenu line 1 stdin: Selected text 2. (2 lines)' "$temp"
grep -Fxq 'dmenu line 2 stdin: Selected text. (2 lines)' "$temp" grep -Fxq 'dmenu line 2 stdin: Selected text. (2 lines)' "$temp"
# xsel should copy both to clipboard *and* primary # xsel should copy both to clipboard *and* primary
grep -Fxq 'xsel args: --logfile /dev/stderr -i --clipboard' "$temp" grep -Fxq 'xsel args: --logfile /dev/null -i --clipboard' "$temp"
grep -Fxq 'xsel args: --logfile /dev/stderr -i --primary' "$temp" grep -Fxq 'xsel args: --logfile /dev/null -i --primary' "$temp"
grep -Fxq 'xsel line 1 stdin: Selected text.' "$temp" grep -Fxq 'xsel line 1 stdin: Selected text.' "$temp"
grep -Fxq "xsel line 2 stdin: Yes, it's selected text." "$temp" grep -Fxq "xsel line 2 stdin: Yes, it's selected text." "$temp"