This commit is contained in:
2021-11-19 11:11:40 +08:00
parent bcf73a8cad
commit 786f96363b
+6 -4
View File
@@ -140,13 +140,15 @@ class HotReload extends Command
public function trigger_reload() public function trigger_reload()
{ {
$this->logger->warning('change reload'); $this->logger->warning('change reload');
$pid = file_get_contents(storage('.swoole.pid')); // $pid = file_get_contents(storage('.swoole.pid'));
if (!empty($pid) && Process::kill($pid, 0)) { // if (!empty($pid) && Process::kill($pid, 0)) {
Process::kill($pid, SIGTERM); // Process::kill($pid, SIGTERM);
} // }
var_dump('kill process.');
if ($this->process && Process::kill($this->process->pid,0)) { if ($this->process && Process::kill($this->process->pid,0)) {
Process::kill($this->process->pid) && Process::wait(true); Process::kill($this->process->pid) && Process::wait(true);
} }
var_dump('kill process end.');
$this->process = new Process(function (Process $process) { $this->process = new Process(function (Process $process) {
$process->exec(PHP_BINARY, [APP_PATH . "kiri.php", "sw:server", "restart"]); $process->exec(PHP_BINARY, [APP_PATH . "kiri.php", "sw:server", "restart"]);
}); });