From 267ebb67c12133bb34f8a75ef8e7bec20ad5a456 Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 16 Nov 2015 13:23:29 +0100 Subject: Lua debugger: redis-cli: show compile errors in LDB mode. --- src/redis-cli.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/redis-cli.c b/src/redis-cli.c index 40b74970a..486d087e8 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -1209,10 +1209,19 @@ static int evalMode(int argc, char **argv) { argv2[2] = sdscatprintf(sdsempty(),"%d",keys); /* Call it */ + int eval_ldb = config.eval_ldb; /* Save it, may be reverteed. */ int retval = issueCommand(argc+3-got_comma, argv2); - if (config.eval_ldb) { - strncpy(config.prompt,"lua debugger> ",sizeof(config.prompt)); - repl(); + if (eval_ldb) { + if (!config.eval_ldb) { + /* If the debugging session ended immediately, there was an + * error compiling the script. Show it and don't enter + * the REPL at all. */ + printf("Eval debugging session can't start:\n"); + cliReadReply(0); + } else { + strncpy(config.prompt,"lua debugger> ",sizeof(config.prompt)); + repl(); + } } return retval; } -- cgit v1.2.1