This commit is contained in:
2021-08-19 18:27:19 +08:00
parent fedef53f93
commit ccba377f13
3 changed files with 18 additions and 6 deletions
+13 -3
View File
@@ -54,12 +54,22 @@ abstract class CustomProcess implements \Server\SInterface\CustomProcess
}
});
} else {
go(function () use ($process) {
Coroutine::create(function () use ($process) {
/** @var Coroutine\Socket $message */
$message = $process->exportSocket();
error($message->recv());
$process->exit(0);
});
Coroutine::create(function () use ($process) {
$data = Coroutine::waitSignal(SIGTERM | SIGKILL, -1);
if ($data) {
$lists = Kiri::app()->getProcess();
foreach ($lists as $process) {
$process->exit(0);
foreach ($lists as $name => $process) {
foreach ($process as $item) {
/** @var Coroutine\Socket $export */
$export = $item->exportSocket();
$export->send([$name => 'exit']);
}
}
}
});