index = $index; } /** * @return string */ public function getName(): string { return 'task.' . $this->index; } /** * @param Process $process * @throws \Exception */ public function process(Process $process): void { $task = \Kiri::getContainer()->get(OnServerTask::class); while (!$this->isStop()) { $read = $process->read(); $task->onTask(null, 0, 0, $read); } } /** * @return $this */ public function onSigterm(): static { pcntl_signal(SIGTERM, function () { $this->isStop = true; }); return $this; } }