diff --git a/src/shared/shell.c b/src/shared/shell.c
index 7bcfcff..0e4cbb7 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
bt_shell_printf("%s\n", data.line);
if (!bt_shell_release_prompt(data.line)) {
- bt_shell_dequeue_exec();
+ /* If a prompt was released with this line,
+ * try to release all the other prompts,
+ * if any are left. Otherwise, the next
+ * line will be executed on
+ * bt_shell_noninteractive_quit.
+ */
+ if (data.saved_prompt)
+ bt_shell_dequeue_exec();
+
return;
}
prompt_input(str, func, user_data);
free(str);
+
+ if (data.line && !queue_isempty(data.queue))
+ /* If a prompt was set to receive input and
+ * data is already available, try to execute
+ * the line and release the prompt.
+ */
+ bt_shell_dequeue_exec();
}
static void prompt_free(void *data)