改名
This commit is contained in:
@@ -33,6 +33,9 @@ class HotReload extends Command
|
|||||||
private ?Process $process = null;
|
private ?Process $process = null;
|
||||||
|
|
||||||
|
|
||||||
|
public Inotify|Scaner $driver;
|
||||||
|
|
||||||
|
|
||||||
protected mixed $source = null;
|
protected mixed $source = null;
|
||||||
|
|
||||||
protected mixed $pipes = [];
|
protected mixed $pipes = [];
|
||||||
@@ -63,9 +66,9 @@ class HotReload extends Command
|
|||||||
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')) {
|
||||||
$driver = Kiri::getDi()->get(Scaner::class, [$this->dirs, $this]);
|
$this->driver = Kiri::getDi()->get(Scaner::class, [$this->dirs, $this]);
|
||||||
} else {
|
} else {
|
||||||
$driver = Kiri::getDi()->get(Inotify::class, [$this->dirs, $this]);
|
$this->driver = Kiri::getDi()->get(Inotify::class, [$this->dirs, $this]);
|
||||||
}
|
}
|
||||||
if (Kiri::getPlatform()->isLinux()) {
|
if (Kiri::getPlatform()->isLinux()) {
|
||||||
swoole_set_process_name('[' . Config::get('id', 'sw service.') . '].sw:wather');
|
swoole_set_process_name('[' . Config::get('id', 'sw service.') . '].sw:wather');
|
||||||
@@ -73,6 +76,7 @@ class HotReload extends Command
|
|||||||
$this->trigger_reload();
|
$this->trigger_reload();
|
||||||
Process::signal(SIGTERM | SIGKILL, function ($data) {
|
Process::signal(SIGTERM | SIGKILL, function ($data) {
|
||||||
var_dump($data);
|
var_dump($data);
|
||||||
|
$this->driver->clear();
|
||||||
$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);
|
||||||
@@ -82,7 +86,7 @@ class HotReload extends Command
|
|||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$driver->start();
|
$this->driver->start();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user