改名
This commit is contained in:
@@ -64,9 +64,6 @@ class FileChangeCustomProcess extends Command
|
||||
$driver = Kiri::getDi()->get(Inotify::class, [$this->dirs, $this]);
|
||||
}
|
||||
$make = Barrier::make();
|
||||
go(function () {
|
||||
$this->source = proc_open('php ' . APP_PATH . 'kiri.php sw:server restart', [], $this->pipes);
|
||||
});
|
||||
go(function () {
|
||||
$sign = Coroutine::waitSignal(SIGTERM, -1);
|
||||
if ($sign) {
|
||||
@@ -74,14 +71,15 @@ class FileChangeCustomProcess extends Command
|
||||
}
|
||||
});
|
||||
go(function () use ($driver) {
|
||||
$driver->start();
|
||||
$this->source = proc_open('php ' . APP_PATH . 'kiri.php sw:server restart', [], $this->pipes);
|
||||
|
||||
$driver->start(Coroutine::getCid());
|
||||
});
|
||||
Barrier::wait($make);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param $code
|
||||
* @param $message
|
||||
@@ -102,10 +100,9 @@ class FileChangeCustomProcess extends Command
|
||||
* 重启
|
||||
* @throws Exception
|
||||
*/
|
||||
public function trigger_reload()
|
||||
public function trigger_reload($cid)
|
||||
{
|
||||
Kiri::getDi()->get(Logger::class)->warning('change reload');
|
||||
|
||||
if (is_resource($this->source)) {
|
||||
proc_close($this->source);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,9 @@ class Inotify
|
||||
|
||||
private array $watchFiles = [];
|
||||
|
||||
|
||||
protected int $cid;
|
||||
|
||||
const IG_DIR = [APP_PATH . 'commands', APP_PATH . '.git', APP_PATH . '.gitee'];
|
||||
|
||||
|
||||
@@ -28,8 +31,9 @@ class Inotify
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function start()
|
||||
public function start($cid)
|
||||
{
|
||||
$this->cid = $cid;
|
||||
$this->inotify = inotify_init();
|
||||
$this->events = IN_MODIFY | IN_DELETE | IN_CREATE | IN_MOVE;
|
||||
foreach ($this->dirs as $dir) {
|
||||
@@ -80,7 +84,7 @@ class Inotify
|
||||
public function reload()
|
||||
{
|
||||
$this->process->isReloading = true;
|
||||
$this->process->trigger_reload();
|
||||
$this->process->trigger_reload($this->cid);
|
||||
|
||||
$this->clearWatch();
|
||||
foreach ($this->dirs as $root) {
|
||||
|
||||
Reference in New Issue
Block a user