Tests: create process group when running daemons. This allows to run daemons indirectly (e.g. via shell) and still be able to kill them without external pid file.
diff --git a/lib/Test/Nginx.pm b/lib/Test/Nginx.pm index 1e2884a..c2a5aee 100644 --- a/lib/Test/Nginx.pm +++ b/lib/Test/Nginx.pm
@@ -114,7 +114,8 @@ while ($self->{_daemons} && scalar @{$self->{_daemons}}) { my $p = shift @{$self->{_daemons}}; - kill 'TERM', $p; + # SIGTERM to process group + kill -15, $p; wait; } @@ -154,6 +155,7 @@ die "Can't fork daemon: $!\n" unless defined $pid; if ($pid == 0) { + setpgrp(0, 0); if (ref($code) eq 'CODE') { $code->(@args); exit 0;