mirror of
https://github.com/espressif/openthread.git
synced 2026-07-29 23:27:46 +00:00
[cli] process exit in ot-ctl (#6605)
The exit command should only exit ot-ctl itself in daemon mode. This commit adds processing exit command in the ot-ctl. This commit also moves the exit command implementation out from core as a user command on simulation and posix cli mode.
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
|
||||
#include "openthread-system.h"
|
||||
#include "cli/cli_config.h"
|
||||
#include "common/code_utils.hpp"
|
||||
|
||||
/**
|
||||
* This function initializes the CLI app.
|
||||
@@ -76,6 +77,18 @@ void otTaskletsSignalPending(otInstance *aInstance)
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_POSIX && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
|
||||
static void ProcessExit(void *aContext, uint8_t aArgsLength, char *aArgs[])
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aContext);
|
||||
OT_UNUSED_VARIABLE(aArgsLength);
|
||||
OT_UNUSED_VARIABLE(aArgs);
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
static const otCliCommand kCommands[] = {{"exit", ProcessExit}};
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
otInstance *instance;
|
||||
@@ -117,6 +130,10 @@ pseudo_reset:
|
||||
|
||||
otAppCliInit(instance);
|
||||
|
||||
#if OPENTHREAD_POSIX && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
|
||||
otCliSetUserCommands(kCommands, OT_ARRAY_LENGTH(kCommands), instance);
|
||||
#endif
|
||||
|
||||
while (!otSysPseudoResetWasRequested())
|
||||
{
|
||||
otTaskletsProcess(instance);
|
||||
|
||||
Reference in New Issue
Block a user