From 4284b3525086a55bbe96f8e9af266e5b8a3711c3 Mon Sep 17 00:00:00 2001
From: Soispha <soispha@vhack.eu>
Date: Mon, 1 Jan 2024 23:39:05 +0100
Subject: fix(hm/pkgs/scr/yts): Always stop the active task, when exiting

---
 hm/soispha/pkgs/scripts/wrappers/yts | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'hm')

diff --git a/hm/soispha/pkgs/scripts/wrappers/yts b/hm/soispha/pkgs/scripts/wrappers/yts
index 3ff8e37a..b5edf52c 100755
--- a/hm/soispha/pkgs/scripts/wrappers/yts
+++ b/hm/soispha/pkgs/scripts/wrappers/yts
@@ -5,6 +5,11 @@ SHELL_LIBRARY_VERSION="1.10.2" . %SHELL_LIBRARY_PATH
 
 TASK_UUID=ce4f9e07-8324-4570-8be6-967955e9271e
 
+cleanup() {
+    task stop "$TASK_UUID"
+}
+trap cleanup EXIT
+
 help_text="
 #
 # Commands:
@@ -57,5 +62,4 @@ done < "$selection_file"
 
 [ "$ids" != "" ] && ytc "$ids";
 
-task stop "$TASK_UUID"
 # vim: ft=sh
-- 
cgit 1.4.1