-
Notifications
You must be signed in to change notification settings - Fork 162
Closed
Labels
Description
Hi.
I'm using mqtt-sub inside a shell script like this:
while :; do
mqtt-sub -h 192.168.100.100 -p 1883 -n mytopic | while read -r SUBSCRIBED; do
...
done
and I noticed that read is not able to get the standard output properly.
A fflush after printf fixes the problem.
Is it possible to add it in the main source?
Here a little patch:
diff -Naur wolfMQTT-1.20.0.ori/examples/pub-sub/mqtt-sub.c wolfMQTT-1.20.0/examples/pub-sub/mqtt-sub.c
--- wolfMQTT-1.20.0.ori/examples/pub-sub/mqtt-sub.c<--->2025-05-01 22:34:47.000000000 +0200
+++ wolfMQTT-1.20.0/examples/pub-sub/mqtt-sub.c>2025-11-25 10:54:53.064091696 +0100
@@ -96,6 +96,7 @@
}
else {
PRINTF("%s", buf);
+ fflush(stdout);
}
.
#ifdef WOLFMQTT_V5
Thank you.