111
This commit is contained in:
@@ -65,14 +65,10 @@ class FileChangeCustomProcess extends Command
|
|||||||
} else {
|
} else {
|
||||||
$driver = Kiri::getDi()->get(Inotify::class, [$this->dirs, $this]);
|
$driver = Kiri::getDi()->get(Inotify::class, [$this->dirs, $this]);
|
||||||
}
|
}
|
||||||
$make = Barrier::make();
|
$this->trigger_reload(0);
|
||||||
go(function () {
|
Coroutine::create(function () use ($driver) {
|
||||||
$this->trigger_reload(0);
|
|
||||||
});
|
|
||||||
go(function () use ($driver) {
|
|
||||||
$driver->start(Coroutine::getCid());
|
$driver->start(Coroutine::getCid());
|
||||||
});
|
});
|
||||||
Barrier::wait($make);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,13 +95,15 @@ class FileChangeCustomProcess extends Command
|
|||||||
*/
|
*/
|
||||||
public function trigger_reload($cid)
|
public function trigger_reload($cid)
|
||||||
{
|
{
|
||||||
Kiri::getDi()->get(Logger::class)->warning('change reload');
|
Kiri::getDi()->get(Logger::class)->warning('change reload');
|
||||||
|
|
||||||
$content = (int)file_get_contents(storage('.swoole.pid'));
|
$content = (int)file_get_contents(storage('.swoole.pid'));
|
||||||
if (!empty($content) && Process::kill($content, 0)) {
|
if (!empty($content) && Process::kill($content, 0)) {
|
||||||
Process::kill($content, SIGTERM);
|
Process::kill($content, SIGTERM);
|
||||||
}
|
}
|
||||||
proc_open("php " . APP_PATH . "kiri.php", [], $pipes);
|
Coroutine::create(function () {
|
||||||
|
proc_open("php " . APP_PATH . "kiri.php", [], $pipes);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user