src/Leevel/Protocol/Console/Base/Stop.php
protected function close(array $option): void
    {
        $pidFile = $option['pid_path'];
        $processName = $option['process_name'];

        if (!file_exists($pidFile)) {
            throw new InvalidArgumentException(
                sprintf('Pid path `%s` was not found.', $pidFile)
            );
        }

        $pids = explode(PHP_EOL, file_get_contents($pidFile));
        $pid = (int) $pids[0];

        if (!Process::kill($pid, 0)) {
            throw new InvalidArgumentException(
                sprintf('Pid `%s` was not found.', $pid)
            );
        }

        Process::kill($pid, SIGKILL);

        if (is_file($pidFile)) {
            unlink($pidFile);
        }

        $this->info(sprintf('Process %s:%d has stoped.', $processName, $pid), true);
    }
protected function close(array $option): void
    {
        $pidFile = $option['pid_path'];
        $processName = $option['process_name'];

        if (!file_exists($pidFile)) {
            throw new InvalidArgumentException(
                sprintf('Pid path `%s` was not found.', $pidFile)
            );
        }

        $pids = explode(PHP_EOL, file_get_contents($pidFile));
        $pid = (int) $pids[0];

        if (!Process::kill($pid, 0)) {
            throw new InvalidArgumentException(
                sprintf('Pid `%s` was not found.', $pid)
            );
        }

        Process::kill($pid, SIGKILL);

        if (is_file($pidFile)) {
            unlink($pidFile);
        }

        $this->info(sprintf('Process %s:%d has stoped.', $processName, $pid), true);
    }
停止 Swoole 服务.

@param array $option