From eee60c9e1156cdbc5225ccfeee86b7e1edcdf46c Mon Sep 17 00:00:00 2001 From: nuno maduro Date: Thu, 11 Jun 2026 10:08:27 +0100 Subject: [PATCH] fix: duplicated team city output --- src/Subscribers/EnsureTeamCityEnabled.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Subscribers/EnsureTeamCityEnabled.php b/src/Subscribers/EnsureTeamCityEnabled.php index 0b9591d2..89793d31 100644 --- a/src/Subscribers/EnsureTeamCityEnabled.php +++ b/src/Subscribers/EnsureTeamCityEnabled.php @@ -15,15 +15,20 @@ use Symfony\Component\Console\Output\OutputInterface; /** * @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. */ public function __construct( - private InputInterface $input, - private OutputInterface $output, - private TestSuite $testSuite, + private readonly InputInterface $input, + private readonly OutputInterface $output, + private readonly TestSuite $testSuite, ) {} /** @@ -31,10 +36,16 @@ final readonly class EnsureTeamCityEnabled implements ConfiguredSubscriber */ public function notify(Configured $event): void { + if (self::$registered) { + return; + } + if (! $this->input->hasParameterOption('--teamcity')) { return; } + self::$registered = true; + $flowId = getenv('FLOW_ID'); $flowId = is_string($flowId) ? (int) $flowId : getmypid();