# HG changeset patch # User Maxim Dounin # Date 1227033854 -10800 # Node ID b01ae969181bf221f7f7717491be52e2f14b0962 # Parent acfafb52d393555808e746b4ffed17695afb44b0 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 --- a/lib/Test/Nginx.pm +++ b/lib/Test/Nginx.pm @@ -114,7 +114,8 @@ sub stop() { 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 @@ sub run_daemon($;@) { die "Can't fork daemon: $!\n" unless defined $pid; if ($pid == 0) { + setpgrp(0, 0); if (ref($code) eq 'CODE') { $code->(@args); exit 0;