改名
This commit is contained in:
@@ -8,13 +8,10 @@ use Kiri\Abstracts\Logger;
|
|||||||
use Kiri\Exception\ConfigException;
|
use Kiri\Exception\ConfigException;
|
||||||
use Kiri\Kiri;
|
use Kiri\Kiri;
|
||||||
use Swoole\Coroutine;
|
use Swoole\Coroutine;
|
||||||
use Swoole\Coroutine\Barrier;
|
|
||||||
use Swoole\Process;
|
use Swoole\Process;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use function Co\run;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,11 +66,38 @@ class FileChangeCustomProcess extends Command
|
|||||||
|
|
||||||
$this->trigger_reload();
|
$this->trigger_reload();
|
||||||
Coroutine::create(function () use ($driver) {
|
Coroutine::create(function () use ($driver) {
|
||||||
|
Coroutine::create(function () {
|
||||||
|
$waite = Coroutine::waitSignal(SIGTERM | SIGKILL);
|
||||||
|
if ($waite) {
|
||||||
|
$this->stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
$driver->start();
|
$driver->start();
|
||||||
});
|
});
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private function stop(): void
|
||||||
|
{
|
||||||
|
if (!file_exists(storage('.swoole.pid'))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$content = (int)file_get_contents(storage('.swoole.pid'));
|
||||||
|
if ($content > 0 && Process::kill($content, 0)) {
|
||||||
|
Process::kill($content, 15);
|
||||||
|
}
|
||||||
|
@unlink(storage('.swoole.pid'));
|
||||||
|
|
||||||
|
if (is_resource($this->source)) {
|
||||||
|
proc_close($this->source);
|
||||||
|
$this->source = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $code
|
* @param $code
|
||||||
* @param $message
|
* @param $message
|
||||||
@@ -119,8 +143,4 @@ class FileChangeCustomProcess extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user