do not print jim tcl error message trace for ERROR_COMMAND_CLOSE_CONNECTION
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Wed, 16 Jul 2008 10:12:29 +0000 (10:12 +0000)
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Wed, 16 Jul 2008 10:12:29 +0000 (10:12 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@812 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/openocd.c

index 2d7e774734b32f9db1531318907589f20b255669..e535b9fe2797f20846e3e3c45eadb8081dee90e4 100644 (file)
@@ -493,6 +493,8 @@ static void tcl_output(void *privData, const char *file, int line, const char *f
        Jim_AppendString(interp, tclOutput, string, strlen(string));
 }
 
+static int openocd_retval; 
+
 /* try to execute as Jim command, otherwise fall back to standard command.
  * Note that even if the Jim command caused an error, then we succeeded
  * to execute it, hence this fn pretty much always returns ERROR_OK. */
@@ -502,20 +504,21 @@ int jim_command(command_context_t *context, char *line)
        int retcode;
 
        active_cmd_ctx = context;
+       openocd_retval=ERROR_OK;
        retcode = Jim_Eval(interp, line);
        
        if (retcode == JIM_ERR) {
-               Jim_PrintErrorMessage(interp);
-           long t;
-           Jim_Obj *openocd_result=Jim_GetVariableStr(interp, "openocd_result", JIM_ERRMSG);
-           if (openocd_result)
-           {
-                   if (Jim_GetLong(interp, openocd_result, &t)==JIM_OK)
-                   {
-                       return t;
-                   }
+               if (openocd_retval!=ERROR_COMMAND_CLOSE_CONNECTION)
+               {
+                       /* We do not print the connection closed error message */
+                       Jim_PrintErrorMessage(interp);
                }
-           return ERROR_FAIL;
+               if (openocd_retval==ERROR_OK)
+               {
+                       /* It wasn't a low level OpenOCD command that failed */
+                       return ERROR_FAIL; 
+               }
+           return openocd_retval;
        } 
        const char *result;
        int reslen;
@@ -562,12 +565,8 @@ static int Jim_Command_openocd_ignore(Jim_Interp *interp, int argc, Jim_Obj *con
        log_add_callback(tcl_output, tclOutput);
        retval=command_run_line_internal(active_cmd_ctx, cmd);
 
-       /* we need to be able to get at the retval, so we store in a variable
-        */
-       Jim_Obj *resultvar=Jim_NewIntObj(interp, retval);
-       Jim_IncrRefCount(resultvar);
-       Jim_SetGlobalVariableStr(interp, "openocd_result", resultvar);
-       Jim_DecrRefCount(interp, resultvar);
+       /* we need to be able to get at the retval, so we store in a global variable */
+       openocd_retval=retval;
        
        if (startLoop)
        {

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)