Fixed server:start failed, when the config of pid_file changed. (#2356)

Co-authored-by: 李铭昕 <715557344@qq.com>
This commit is contained in:
N 2020-08-27 10:39:27 +08:00 committed by GitHub
parent 339ecd9e2e
commit 87590fb644
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -9,6 +9,7 @@
## Fixed
- [#2331](https://github.com/hyperf/hyperf/pull/2331) Fixed exception thrown when the service or config was not found for nacos.
- [#2356](https://github.com/hyperf/hyperf/pull/2356) Fixed `server:start` failed, when the config of pid_file changed.
# v2.0.8 - 2020-08-24

View File

@ -16,6 +16,7 @@ use Hyperf\Di\Annotation\ScanConfig;
use Hyperf\Di\ClassLoader;
use Hyperf\Utils\Codec\Json;
use Hyperf\Utils\Coroutine;
use Hyperf\Utils\Filesystem\FileNotFoundException;
use Hyperf\Utils\Filesystem\Filesystem;
use Hyperf\Watcher\Driver\DriverInterface;
use PhpParser\PrettyPrinter\Standard;
@ -146,7 +147,10 @@ class Watcher
public function restart($isStart = true)
{
$file = BASE_PATH . '/runtime/hyperf.pid';
$file = config('server.settings.pid_file');
if (empty($file)) {
throw new FileNotFoundException('pid_file is not found.');
}
if (! $isStart && $this->filesystem->exists($file)) {
$pid = $this->filesystem->get($file);
try {