Skip to content

Commit 0ad02f1

Browse files
committed
ACQE-5706 : no-ansi fix
1 parent f2c8e1e commit 0ad02f1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Magento/FunctionalTestingFramework/Console/RunTestGroupCommand.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6767
$xml = ($input->getOption('xml'))
6868
? '--xml'
6969
: "";
70+
$noAnsi = ($input->getOption('no-ansi'))
71+
? '--no-ansi'
72+
: "";
7073
$skipGeneration = $input->getOption('skip-generate');
7174
$force = $input->getOption('force');
7275
$groups = $input->getArgument('groups');
@@ -136,7 +139,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
136139
$process->setIdleTimeout(600);
137140
$process->setTimeout(0);
138141
$returnCodes[] = $process->run(
139-
function ($type, $buffer) use ($output) {
142+
function ($type, $buffer) use ($output, $noAnsi) {
143+
if ($noAnsi != "") {
144+
$pattern = "/\x1B\[([0-9]{1,2}(;[0-9]{1,2})*)?[m|K]/";
145+
// Use preg_replace to remove ANSI escape codes from the string
146+
$buffer = preg_replace($pattern, '', $buffer);
147+
}
140148
$output->write($buffer);
141149
}
142150
);

0 commit comments

Comments
 (0)