fix: duplicated team city output

This commit is contained in:
nuno maduro
2026-06-11 10:08:27 +01:00
parent c40c8dbc24
commit eee60c9e11

View File

@ -15,15 +15,20 @@ use Symfony\Component\Console\Output\OutputInterface;
/** /**
* @internal * @internal
*/ */
final readonly class EnsureTeamCityEnabled implements ConfiguredSubscriber final class EnsureTeamCityEnabled implements ConfiguredSubscriber
{ {
/**
* Indicates if the TeamCity logger has already been registered.
*/
private static bool $registered = false;
/** /**
* Creates a new Configured Subscriber instance. * Creates a new Configured Subscriber instance.
*/ */
public function __construct( public function __construct(
private InputInterface $input, private readonly InputInterface $input,
private OutputInterface $output, private readonly OutputInterface $output,
private TestSuite $testSuite, private readonly TestSuite $testSuite,
) {} ) {}
/** /**
@ -31,10 +36,16 @@ final readonly class EnsureTeamCityEnabled implements ConfiguredSubscriber
*/ */
public function notify(Configured $event): void public function notify(Configured $event): void
{ {
if (self::$registered) {
return;
}
if (! $this->input->hasParameterOption('--teamcity')) { if (! $this->input->hasParameterOption('--teamcity')) {
return; return;
} }
self::$registered = true;
$flowId = getenv('FLOW_ID'); $flowId = getenv('FLOW_ID');
$flowId = is_string($flowId) ? (int) $flowId : getmypid(); $flowId = is_string($flowId) ? (int) $flowId : getmypid();