Mercurial > hg > nginx-tests
changeset 49:b01ae969181b
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.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 18 Nov 2008 21:44:14 +0300 |
parents | acfafb52d393 |
children | b494fe5b12d1 c7e29639f915 |
files | lib/Test/Nginx.pm |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/Test/Nginx.pm Tue Nov 18 20:43:47 2008 +0300 +++ b/lib/Test/Nginx.pm Tue Nov 18 21:44:14 2008 +0300 @@ -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;