From 33539615c33cd395e6b0d873317ad1c278ce6b18 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Tue, 18 Oct 2022 16:47:38 +0200 Subject: [PATCH] [Simulated Test] Simulated node does not have a chance to send the interaction response for the last step on success (#23224) --- examples/placeholder/linux/include/TestCommand.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/examples/placeholder/linux/include/TestCommand.h b/examples/placeholder/linux/include/TestCommand.h index f40f1466c9d14e..027e6f53d17a47 100644 --- a/examples/placeholder/linux/include/TestCommand.h +++ b/examples/placeholder/linux/include/TestCommand.h @@ -87,7 +87,21 @@ class TestCommand : public TestRunner, void Exit(std::string message, CHIP_ERROR err) override { LogEnd(message, err); - SetCommandExitStatus(err); + + if (CHIP_NO_ERROR == err) + { + chip::DeviceLayer::PlatformMgr().ScheduleWork(AsyncExit, reinterpret_cast(this)); + } + else + { + SetCommandExitStatus(err); + } + } + + static void AsyncExit(intptr_t context) + { + TestCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void ScheduleNextTest(intptr_t context)