1
This commit is contained in:
@@ -92,7 +92,6 @@ class HotReload extends Command
|
|||||||
#[NoReturn] public function onSignal($data)
|
#[NoReturn] public function onSignal($data)
|
||||||
{
|
{
|
||||||
$pid = file_get_contents(storage('.swoole.pid'));
|
$pid = file_get_contents(storage('.swoole.pid'));
|
||||||
var_dump($pid);
|
|
||||||
if (!empty($pid) && Process::kill($pid, 0)) {
|
if (!empty($pid) && Process::kill($pid, 0)) {
|
||||||
Process::kill($pid, SIGTERM);
|
Process::kill($pid, SIGTERM);
|
||||||
}
|
}
|
||||||
@@ -100,23 +99,6 @@ class HotReload extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function onExit()
|
|
||||||
{
|
|
||||||
$data = Coroutine::waitSignal(SIGTERM | SIGKILL, -1);
|
|
||||||
if ($data) {
|
|
||||||
$pid = file_get_contents(storage('.swoole.pid'));
|
|
||||||
if (!empty($pid) && Process::kill($pid, 0)) {
|
|
||||||
Process::kill($pid, SIGTERM);
|
|
||||||
}
|
|
||||||
$this->stop();
|
|
||||||
$this->source = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@@ -126,11 +108,8 @@ class HotReload extends Command
|
|||||||
proc_terminate($this->source);
|
proc_terminate($this->source);
|
||||||
while (proc_get_status($this->source)['running']) {
|
while (proc_get_status($this->source)['running']) {
|
||||||
Coroutine::sleep(1);
|
Coroutine::sleep(1);
|
||||||
var_dump(proc_get_status($this->source)['running']);
|
|
||||||
}
|
}
|
||||||
var_dump(proc_get_status($this->source)['running']);
|
|
||||||
proc_close($this->source);
|
proc_close($this->source);
|
||||||
var_dump('isClose.');
|
|
||||||
$this->source = NULL;
|
$this->source = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -165,8 +144,9 @@ class HotReload extends Command
|
|||||||
if (!empty($pid) && Process::kill($pid, 0)) {
|
if (!empty($pid) && Process::kill($pid, 0)) {
|
||||||
Process::kill($pid, SIGTERM);
|
Process::kill($pid, SIGTERM);
|
||||||
}
|
}
|
||||||
|
$this->stop();
|
||||||
Coroutine::create(function () {
|
Coroutine::create(function () {
|
||||||
proc_open('php ' . APP_PATH . '/kiri.php sw:server restart', [], $pipes);
|
$this->source = proc_open('php ' . APP_PATH . '/kiri.php sw:server restart', [], $pipes);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user