commit 0e8b75ec88facd50a26c1ee165d4e5c7e0c43fbe
parent 2a17c6160c4a109220f2f918454854d52d696234
Author: Ayush Agarwal <ayushnix@fastmail.com>
Date: Wed, 2 Mar 2022 07:15:53 +0530
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.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git 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 &