[PATCH BlueZ] shared/shell: Fix non-interactive mode with no input stream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When the input stream doesn't support epoll, the non-interactive mode
should still print its output.

Showed up when a script was run as a systemd service. For testing
consider that the following command should report a version string:

btmgmt version < /dev/null
Version 5.49
---
 src/shared/shell.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/shared/shell.c b/src/shared/shell.c
index e7f17e021..aa20c30f7 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -460,9 +460,6 @@ void bt_shell_printf(const char *fmt, ...)
 	char *saved_line;
 	int saved_point;
 
-	if (!data.input)
-		return;
-
 	if (data.mode) {
 		va_start(args, fmt);
 		vprintf(fmt, args);
@@ -470,6 +467,9 @@ void bt_shell_printf(const char *fmt, ...)
 		return;
 	}
 
+	if (!data.input)
+		return;
+
 	save_input = !RL_ISSTATE(RL_STATE_DONE);
 
 	if (save_input) {
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux