REPL: ignore blank lines.

Signed-off-by: Yilin Sun <imi415@imi.moe>
This commit is contained in:
Yilin Sun 2023-03-08 00:36:23 +08:00
parent 6b98725b34
commit 9b4660bd75
Signed by: imi415
GPG Key ID: 17F01E106F9F5E0A
2 changed files with 8 additions and 4 deletions

View File

@ -1,4 +1,5 @@
#include <malloc.h>
#include <string.h>
/* FreeRTOS */
#include "FreeRTOS.h"
@ -67,7 +68,7 @@ int app_mrb_repl_exec(bool *exit) {
uint32_t heap_used, heap_total;
app_mrb_repl_heap_usage(&heap_used, &heap_total);
snprintf(prompt_str, 64, "[%4.02lfkiB/%4.02lfkiB](irb)> ", APP_B_TO_KF(heap_used), APP_B_TO_KF(heap_total));
snprintf(prompt_str, 64, "[%.02lf/%.02lfkiB](mirb)> ", APP_B_TO_KF(heap_used), APP_B_TO_KF(heap_total));
line = linenoise(prompt_str);
@ -76,8 +77,11 @@ int app_mrb_repl_exec(bool *exit) {
return 0;
}
linenoiseHistoryAdd(line);
printf("You entered: %s\n", line);
if(strlen(line) != 0) {
linenoiseHistoryAdd(line);
printf("You entered: %s\n", line);
}
free(line);
*exit = false;

View File

@ -46,7 +46,7 @@ static void app_mrb_runtime_task(void *parameters) {
for (;;) {
exit_repl = false;
if(app_mrb_repl_init() != 0){
printf("Failed to initialize mruby REPL engine.\n");
goto task_fail;