This commit is contained in:
2021-11-04 23:48:53 +08:00
parent a5519b927b
commit 3ddec68d7f
@@ -57,7 +57,7 @@ class FileChangeCustomProcess extends Command
public function execute(InputInterface $input, OutputInterface $output): int public function execute(InputInterface $input, OutputInterface $output): int
{ {
// TODO: Implement onHandler() method. // TODO: Implement onHandler() method.
// set_error_handler([$this, 'onErrorHandler']); set_error_handler([$this, 'onErrorHandler']);
$this->dirs = Config::get('inotify', [APP_PATH . 'app']); $this->dirs = Config::get('inotify', [APP_PATH . 'app']);
if (!extension_loaded('inotify')) { if (!extension_loaded('inotify')) {
@@ -67,14 +67,9 @@ class FileChangeCustomProcess extends Command
} }
$make = Barrier::make(); $make = Barrier::make();
go(function () { go(function () {
$sign = Coroutine::waitSignal(SIGTERM, -1); $this->trigger_reload(0);
if ($sign) {
proc_close($this->source);
}
}); });
go(function () use ($driver) { go(function () use ($driver) {
proc_open('php ' . APP_PATH . 'kiri.php', [], $pipes);
$driver->start(Coroutine::getCid()); $driver->start(Coroutine::getCid());
}); });
Barrier::wait($make); Barrier::wait($make);
@@ -116,4 +111,9 @@ class FileChangeCustomProcess extends Command
proc_open("php " . APP_PATH . "kiri.php", [], $pipes); proc_open("php " . APP_PATH . "kiri.php", [], $pipes);
} }
} }