Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the deploy script kill child processes upon exit #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions modules/deploy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this again, I'm not actually sure how this does anything. According to this answer, kill -0 doesn't really do anything.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, this is kill 0, not kill -0 -- 0 is the PID (special-cased?).

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh, yeah, kill 0 is documented as

0      All processes in the current process group are signaled.

Makes sense now

${lib.concatMapStrings (node: lib.optionalString node.enabled ''

${node.deployScript} &
Expand Down