This commit is contained in:
xl
2024-11-18 16:42:28 +08:00
parent 9fcd47ecd1
commit 0849870234
+2 -2
View File
@@ -74,8 +74,8 @@ class HotReload extends AbstractProcess
*/ */
public function process(Process|null $process): void public function process(Process|null $process): void
{ {
$this->pipe = inotify_init();
$this->addListen(); $this->addListen();
Event::add($this->pipe, function () use ($process) { Event::add($this->pipe, function () use ($process) {
$read = inotify_read($this->pipe); $read = inotify_read($this->pipe);
@@ -126,7 +126,6 @@ class HotReload extends AbstractProcess
*/ */
protected function addListen(): void protected function addListen(): void
{ {
$this->pipe = inotify_init();
foreach (config('reload.listen') as $value) { foreach (config('reload.listen') as $value) {
$this->readDirectory($value); $this->readDirectory($value);
} }
@@ -138,6 +137,7 @@ class HotReload extends AbstractProcess
*/ */
protected function clear(): void protected function clear(): void
{ {
var_dump($this->watches);
foreach ($this->watches as $key => $watch) { foreach ($this->watches as $key => $watch) {
inotify_rm_watch($this->pipe, $key); inotify_rm_watch($this->pipe, $key);
} }