From deb9e1bb3caccddd51e8c839e3f638537dfd1ae2 Mon Sep 17 00:00:00 2001 From: "M. Grechanik" Date: Mon, 23 Jun 2025 07:36:35 +0300 Subject: [PATCH 1/2] 493: Passing environment variables to sub-processes --- CHANGELOG.md | 1 + src/cli/Command.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 541d80ee0..c62fb628b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Yii2 Queue Extension Change Log - Enh #516: Ensure Redis driver messages are consumed at least once (soul11201) - Bug #522: Fix SQS driver type error with custom value passed to `queue/listen` (flaviovs) - Bug #528: Prevent multiple execution of aborted jobs (luke-) +- Enh #493: Passing environment variables to sub-processes (mgrechanik) 2.3.7 April 29, 2024 -------------------- diff --git a/src/cli/Command.php b/src/cli/Command.php index 5a8758e4d..da9363e9a 100644 --- a/src/cli/Command.php +++ b/src/cli/Command.php @@ -181,8 +181,8 @@ protected function handleMessage($id, $message, $ttr, $attempt) if (!in_array('color', $this->getPassedOptions(), true)) { $cmd[] = '--color=' . $this->isColorEnabled(); } - - $process = new Process($cmd, null, null, $message, $ttr); + $env = isset($_ENV) ? $_ENV : null; + $process = new Process($cmd, null, $env, $message, $ttr); try { $result = $process->run(function ($type, $buffer) { if ($type === Process::ERR) { From 31bdc2fa25264071390bd37cda5168a3dd893afc Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 27 Jun 2025 11:52:46 +0300 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c62fb628b..849a92175 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ Yii2 Queue Extension Change Log - Enh #516: Ensure Redis driver messages are consumed at least once (soul11201) - Bug #522: Fix SQS driver type error with custom value passed to `queue/listen` (flaviovs) - Bug #528: Prevent multiple execution of aborted jobs (luke-) -- Enh #493: Passing environment variables to sub-processes (mgrechanik) +- Enh #493: Pass environment variables to sub-processes (mgrechanik) 2.3.7 April 29, 2024 --------------------