This is an automated email from Gerrit. Antonio Borneo (borneo.anto...@gmail.com) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/5178
-- gerrit commit 74c5a3e71a4ad4c3b103fc4631d1a4d2892812e8 Author: Antonio Borneo <borneo.anto...@gmail.com> Date: Wed May 15 16:27:26 2019 +0200 helper/command: print the command output in case of error In case of error, a command should use command_print() to report the error message, so it get printed only on the session that run the command itself, and the message can be intercepted with the tcl command catch if it has to be handled differently. Current code drops the command output when the command returns error, claiming that it's the command that *should* have printed it already. This is true only if we *abuse* of the LOG functions, but accepting the side issue of having the LOG printed in every session and being unable to catch{} the error message. Since we have switched to command_print(), change the code to propagate the command output also in case of error. Change-Id: I95de424a65e63702bdb3b2277749a0ac6aaaa503 Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com> diff --git a/src/helper/command.c b/src/helper/command.c index e8ade3f..3346a6c 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -623,15 +623,13 @@ static int run_command(struct command_context *context, } } else if (retval == ERROR_COMMAND_CLOSE_CONNECTION) { /* just fall through for a shutdown request */ - } else if (retval != ERROR_OK) { - /* we do not print out an error message because the command *should* - * have printed out an error - */ - char *full_name = command_name(c, ' '); - LOG_DEBUG("Command '%s' failed with error code %d", - full_name ? full_name : c->name, retval); - free(full_name); } else { + if (retval != ERROR_OK) { + char *full_name = command_name(c, ' '); + LOG_DEBUG("Command '%s' failed with error code %d", + full_name ? full_name : c->name, retval); + free(full_name); + } /* Use the command output as the Tcl result */ Jim_SetResult(context->interp, cmd.output); } -- _______________________________________________ OpenOCD-devel mailing list OpenOCD-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openocd-devel