From aa2437a313f6ad3e16dc40bfc0adff59371eaed4 Mon Sep 17 00:00:00 2001 From: Yang Song Date: Thu, 19 Mar 2026 08:51:40 +0800 Subject: [PATCH] [cli] prevent ot-ctl termination during debug command (#12600) Under interactive mode, the `ot-ctl` client treats lines starting with "Error" as fatal command failures. It exits immediately and stop receiving CLI output. As the `debug` command runs a sequence of sub-commands; if one fails , the entire debug session would stop. This change modifies the error prefix to "ERROR" for internal debug commands, allowing ot-ctl to continue processing subsequent output. Also, it adds an explicit `OutputLine("Done")` at the end of the debug command processing to ensure the CLI client correctly detects the end of the command. --- src/cli/cli.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 223a2aa1f..570205e63 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -164,7 +164,9 @@ void Interpreter::OutputResult(otError aError) { if (aError != OT_ERROR_NONE) { - OutputLine("Error %u: %s", aError, otThreadErrorToString(aError)); + // For internal debug commands, prepending `*` to prevent cli client from treating this as a fatal error and + // exit. + OutputLine("* Error %u: %s", aError, otThreadErrorToString(aError)); } ExitNow();