Better child kill.

This commit is contained in:
sergiotarxz 2021-11-14 01:18:27 +01:00
parent dd1d7c783f
commit 590b56e610
1 changed files with 2 additions and 1 deletions

View File

@ -16,6 +16,7 @@ use Cualsea::Server::MonitorController;
my $pid = fork;
if ($pid) {{
local $SIG{INT} = \&finish_parent;
local $SIG{TERM} = \&finish_parent;
while (1) {
my $loop = Cualsea::Server::Loop->new;
try {
@ -33,7 +34,7 @@ while (1) {
}
sub finish_parent {
kill 'INT', $pid;
kill 'KILL', $pid;
1 while waitpid $pid, WNOHANG;
exit;
}