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;
}
return retval;
} else if (retcode == JIM_EXIT) {
- /* ignore.
- * exit(Jim_GetExitCode(interp)); */
+ return ERROR_OK_EXIT;
} else {
const char *result;
int reslen;