From 81e38d476d871120dc53d3647ede8623d05b96cf Mon Sep 17 00:00:00 2001 From: Robbe Van Petegem Date: Sat, 14 Dec 2024 09:23:28 +0100 Subject: [PATCH] Don't try to kill a process that already exited --- modules/services.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/services.nix b/modules/services.nix index c36234d..b630bae 100644 --- a/modules/services.nix +++ b/modules/services.nix @@ -73,7 +73,9 @@ let pid=$! echo $pid > "$PRJ_DATA_DIR/pids/${gName}.pid" on_stop() { - kill -TERM $pid + if ps -p $pid > /dev/null; then + kill -TERM $pid + fi rm "$PRJ_DATA_DIR/pids/${gName}.pid" wait $pid }