Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix placeholder app shutdown to actually do a clean stack shutdown. #24714

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion examples/placeholder/linux/include/TestCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ class TestCommand : public TestRunner,
void SetCommandExitStatus(CHIP_ERROR status)
{
chip::DeviceLayer::PlatformMgr().StopEventLoopTask();
exit(CHIP_NO_ERROR == status ? EXIT_SUCCESS : EXIT_FAILURE);
mExitCode = (CHIP_NO_ERROR == status ? EXIT_SUCCESS : EXIT_FAILURE);
}

int GetCommandExitCode() { return mExitCode; }

template <typename T>
size_t AddArgument(const char * name, chip::Optional<T> * value)
{
Expand Down Expand Up @@ -176,6 +178,8 @@ class TestCommand : public TestRunner,
chip::app::ConcreteAttributePath mAttributePath;
chip::Optional<chip::NodeId> mCommissionerNodeId;
chip::Optional<chip::EndpointId> mEndpointId;
int mExitCode = EXIT_SUCCESS;

void SetIdentity(const char * name){};

/////////// DelayCommands Interface /////////
Expand Down
6 changes: 6 additions & 0 deletions examples/placeholder/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,11 @@ int main(int argc, char * argv[])
}

ChipLinuxAppMainLoop();

if (test != nullptr)
{
return test->GetCommandExitCode();
}

return 0;
}