diff options
author | Stian Skjelsad <stian@nixia.no> | 2012-02-18 16:10:19 +0100 |
---|---|---|
committer | Freddie Chopin <freddie.chopin@gmail.com> | 2012-07-11 08:16:04 +0000 |
commit | e8641695c634109ebf5f1149923971770da1d28a (patch) | |
tree | f731072858a0ff2225dc95d3efd7d46e8b408eed /src/helper | |
parent | 9ce207a52affec0270678808ce760450905c3f7d (diff) | |
download | riscv-openocd-e8641695c634109ebf5f1149923971770da1d28a.zip riscv-openocd-e8641695c634109ebf5f1149923971770da1d28a.tar.gz riscv-openocd-e8641695c634109ebf5f1149923971770da1d28a.tar.bz2 |
When calling openocd from a shell like this:
openocd -f board/sheevaplug.cfg -c init -c exit
the calling shell will believe that openocd exited with an error due to exitval will be non-zero
This is not tested against incomming telnet
Change-Id: I63d15715a7b46f39a7de261a45039f8c3cad7a98
Signed-off-by: Stian Skjelstad <stian@nixia.no>
Reviewed-on: http://openocd.zylin.com/470
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Bill Traynor <wmat@alphatroop.com>
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Diffstat (limited to 'src/helper')
-rw-r--r-- | src/helper/command.c | 16 | ||||
-rw-r--r-- | src/helper/log.h | 2 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/helper/command.c b/src/helper/command.c index ef0afa2..868d095 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -118,10 +118,15 @@ static void command_log_capture_finish(struct log_capture_state *state) static int command_retval_set(Jim_Interp *interp, int retval) { int *return_retval = Jim_GetAssocData(interp, "retval"); - if (return_retval != NULL) - *return_retval = retval; - - return (retval == ERROR_OK) ? JIM_OK : JIM_ERR; + if (retval == ERROR_COMMAND_CLOSE_CONNECTION) { + if (return_retval != NULL) + *return_retval = 0; + return JIM_EXIT; + } else { + if (return_retval != NULL) + *return_retval = retval; + return (retval == ERROR_OK) ? JIM_OK : JIM_ERR; + } } extern struct command_context *global_cmd_ctx; @@ -671,8 +676,7 @@ int command_run_line(struct command_context *context, char *line) } return retval; } else if (retcode == JIM_EXIT) { - /* ignore. - * exit(Jim_GetExitCode(interp)); */ + return ERROR_OK_EXIT; } else { const char *result; int reslen; diff --git a/src/helper/log.h b/src/helper/log.h index e161a6e..ad8d247 100644 --- a/src/helper/log.h +++ b/src/helper/log.h @@ -138,5 +138,5 @@ extern int debug_level; * make no assumptions about what went wrong and try to handle the problem. */ #define ERROR_FAIL (-4) - +#define ERROR_OK_EXIT (-5) #endif /* LOG_H */ |