Diff between 32e9d15a60948ad1e912f6660e9dea6d8c5265d1 and fcbea6f3658d979622aad1a7f1311aaf0f7abd53

Changed Files

File Additions Deletions Status
src/shared/shell.c +16 -1 modified

Full Patch

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
@@ -638,7 +638,15 @@ static void bt_shell_dequeue_exec(void)
 	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;
 	}
 
@@ -693,6 +701,13 @@ void bt_shell_prompt_input(const char *label, const char *msg,
 	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)