From 60647eb038aba541b6372c8f7c7e954bd81d9c84 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 7 Nov 2022 15:39:24 +0100 Subject: [PATCH] icingacli test php unit: pass through phpunit exit code so that GHA knows if something failed. (cherry picked from commit 522d041505ecb92ee66395a3d7c647c3926f8e06) --- .../application/clicommands/PhpCommand.php | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/modules/test/application/clicommands/PhpCommand.php b/modules/test/application/clicommands/PhpCommand.php index c8dcc16c3..2ff89c28d 100644 --- a/modules/test/application/clicommands/PhpCommand.php +++ b/modules/test/application/clicommands/PhpCommand.php @@ -80,22 +80,20 @@ class PhpCommand extends Command . " -c {$temp->resolvePath('phpunit.xml')}" . ' ' . join(' ', array_merge($options, $this->params->getAllStandalone())); - if ($this->isVerbose) { - $res = `$command`; - foreach (preg_split('/\n/', $res) as $line) { - if (preg_match('~\s+\[([x\s])\]\s~', $line, $m)) { - if ($m[1] === 'x') { - echo $this->screen->colorize($line, 'green') . "\n"; - } else { - echo $this->screen->colorize($line, 'red') . "\n"; - } - } else { - echo $line . "\n"; - } + exec($command, $output, $resultCode); + + foreach ($output as $line) { + if ($this->isVerbose && preg_match('~\s+\[([x\s])\]\s~', $line, $m)) { + echo $this->screen->colorize($line, $m[1] === 'x' ? 'green' : 'red'); + } else { + echo $line; } - } else { - passthru($command); + + echo "\n"; } + + $temp = null; + exit($resultCode); } /**