diff options
author | Ayush Agarwal <ayushnix@fastmail.com> | 2022-03-02 07:15:53 +0530 |
---|---|---|
committer | Ayush Agarwal <ayushnix@fastmail.com> | 2022-03-02 07:15:53 +0530 |
commit | 0e8b75ec88facd50a26c1ee165d4e5c7e0c43fbe (patch) | |
tree | dbbf2e0911d9fd514d3ca80807b638b57e4a51f7 | |
parent | 2a17c6160c4a109220f2f918454854d52d696234 (diff) |
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.
-rwxr-xr-x | tessen | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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 & |