Use getmypid() as dependency (improve testing)

このコミットが含まれているのは:
Philipp Holzer 2020-09-19 20:28:01 +02:00
コミット c9e510d4fd
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: 9A28B7D4FF5667BD
3個のファイルの変更4行の追加3行の削除

ファイルの表示

@ -67,14 +67,14 @@ class Process
*/
private $pid;
public function __construct(LoggerInterface $logger, App\Mode $mode, IConfig $config, Model\Process $processModel, string $basepath)
public function __construct(LoggerInterface $logger, App\Mode $mode, IConfig $config, Model\Process $processModel, string $basepath, int $pid)
{
$this->logger = $logger;
$this->mode = $mode;
$this->config = $config;
$this->basePath = $basepath;
$this->processModel = $processModel;
$this->pid = getmypid();
$this->pid = $pid;
}
/**

ファイルの表示

@ -1172,7 +1172,7 @@ class Worker
$args = ['no_cron' => !$do_cron];
$a = DI::app();
$process = new Core\Process(DI::logger(), DI::mode(), DI::config(), $a->getBasePath());
$process = new Core\Process(DI::logger(), DI::mode(), DI::config(), DI::modelProcess(), $a->getBasePath(), getmypid());
$process->run($command, $args);
// after spawning we have to remove the flag.

ファイルの表示

@ -187,6 +187,7 @@ return [
Process::class => [
'constructParams' => [
[Dice::INSTANCE => '$basepath'],
getmypid(),
],
],
App\Router::class => [