This commit is contained in:
xl
2023-07-10 10:29:39 +08:00
parent 00cbeb819c
commit b7e347162e
+13 -1
View File
@@ -48,7 +48,19 @@ class HotReload extends BaseProcess
if (Context::inCoroutine()) { if (Context::inCoroutine()) {
Coroutine::create(fn() => $this->onShutdown(Coroutine::waitSignal(SIGTERM | SIGINT))); Coroutine::create(fn() => $this->onShutdown(Coroutine::waitSignal(SIGTERM | SIGINT)));
} else { } else {
Process::signal(SIGTERM | SIGINT, function ($data) { Process::signal(SIGTERM, function ($data) {
var_dump('收到消息');
foreach ($this->watchFiles as $file) {
@inotify_rm_watch($file, $this->inotify);
}
$this->onShutdown($data);
});
Process::signal(SIGINT, function ($data) {
var_dump('收到消息');
foreach ($this->watchFiles as $file) { foreach ($this->watchFiles as $file) {
@inotify_rm_watch($file, $this->inotify); @inotify_rm_watch($file, $this->inotify);
} }