Skip to content

Commit b4948a1

Browse files
committed
Ensure environment initialization and simplify type usage
Adds a check to initialize the environment in the setJob method of the CommonExecutor class, ensuring proper configuration before usage. Simplifies the type declaration of the Process property in the Native executor for improved code readability.
1 parent 3f6706e commit b4948a1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/MultiFlexi/CommonExecutor.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ public function __construct(Job &$job)
4141

4242
public function setJob(Job &$job): void
4343
{
44+
/**
45+
* Ensure environment is initialized before use.
46+
*/
47+
if (!isset($this->environment)) {
48+
$this->environment = new ConfigFields('Executor'.\Ease\Functions::baseClassName($this));
49+
}
4450
$this->job = &$job;
4551
$this->setObjectName($job->getMyKey().'@'.\Ease\Logger\Message::getCallerName($this));
4652
$this->environment->addFields($job->getEnvironment());

src/MultiFlexi/Executor/Native.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
class Native extends \MultiFlexi\CommonExecutor implements \MultiFlexi\executor
2828
{
2929
public $timeout = 32767;
30-
private \Symfony\Component\Process\Process $process;
30+
private Process $process;
3131
private string $commandline;
3232
private \MultiFlexi\ConfigFields $jobFiles;
3333

0 commit comments

Comments
 (0)