From 0e8b75ec88facd50a26c1ee165d4e5c7e0c43fbe Mon Sep 17 00:00:00 2001 From: Ayush Agarwal Date: Wed, 2 Mar 2022 07:15:53 +0530 Subject: fix: if sleep is terminated, terminate the pgrp This embarrasing bug escaped my notice until #21 was raised and I tried to make the clipboard clearing behavior saner. `kill` is a bash built-in and `kill 0` sends the default SIGTERM signal to all processes in the same process group (PGID). If `sleep $tsn_cliptime` is killed for any reason, `kill 0` should end up killing `wl-copy` as well. This can be confirmed by manually sending a SIGTERM to the sleep process. --- tessen | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tessen b/tessen index 5caf939..98886d7 100755 --- a/tessen +++ b/tessen @@ -479,7 +479,7 @@ wld_copy() { "Copied username to clipboard. Will clear in $tsn_cliptime seconds." fi { - sleep "$tsn_cliptime" || exit 1 + sleep "$tsn_cliptime" || kill 0 wl-copy --clear } > /dev/null 2>&1 & -- cgit v1.2.3