From b074b81f0f875e1cc1e37e047e99fe8ad40483a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 1 Nov 2020 14:53:54 +0100 Subject: [PATCH] Make the deploy script kill child processes upon exit This allows aborting the deploy with Ctrl-C. Fixes #5. --- modules/deploy.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/deploy.nix b/modules/deploy.nix index 35a1550..42f7f0f 100644 --- a/modules/deploy.nix +++ b/modules/deploy.nix @@ -214,6 +214,8 @@ in { # TODO: Handle signals to kill the async command nixus.pkgs.writeScript "deploy" '' #!${nixus.pkgs.runtimeShell} + trap "echo Received signal, exiting; exit" INT TERM + trap "kill 0" EXIT ${lib.concatMapStrings (node: lib.optionalString node.enabled '' ${node.deployScript} &