From 28d8db8860ef823041a138c8757a6025286fb049 Mon Sep 17 00:00:00 2001 From: Chris Down Date: Fri, 17 Mar 2017 01:18:29 +0000 Subject: [PATCH] clipmenud: Time out all calls to xsel after 1 second MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I'm not entirely sure how this happens, but sometimes xsel gets rather stuck: % systemctl --user status clipmenud ● clipmenud.service - Clipmenu daemon Loaded: loaded (/usr/lib/systemd/user/clipmenud.service; disabled; vendor preset: enabled) Active: active (running) since Wed 2017-03-15 11:14:14 GMT; 1 day 13h ago Main PID: 31630 (clipmenud) CGroup: /user.slice/user-1000.slice/user@1000.service/clipmenud.service ├─ 9052 /bin/bash /usr/bin/clipmenud ├─ 9053 xsel --logfile /dev/null -o --primary └─31630 /bin/bash /usr/bin/clipmenud Mar 15 11:14:14 gongzuo systemd[474]: Started Clipmenu daemon. % strace -p 9053 strace: Process 9053 attached restart_syscall(<... resuming interrupted restart_syscall ...>^Cstrace: Process 9053 detached % ps aux | grep 9053 cdown 9053 0.0 0.0 15956 896 ? S Mar15 0:00 xsel --logfile /dev/null -o --primary --- clipmenud | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clipmenud b/clipmenud index 71be9cf..0f440c1 100755 --- a/clipmenud +++ b/clipmenud @@ -7,7 +7,7 @@ lock_file=$cache_dir/lock lock_timeout=2 _xsel() { - xsel --logfile /dev/null "$@" + timeout 1 xsel --logfile /dev/null "$@" } get_first_line() {