]> sigrok.org Git - sigrok-cli.git/blobdiff - sigrok-cli.c
cli: flush output on write
[sigrok-cli.git] / sigrok-cli.c
index 3bda15857377cb9f4c7546a08001eb9f6d797eec..a1cb674bcd90ede392b4693dc8e971ef792f8094 100644 (file)
@@ -583,6 +583,7 @@ static void datafeed_in(struct sr_dev *dev, struct sr_datafeed_packet *packet)
                                o->format->data(o, filter_out, filter_out_len, &output_buf, &output_len);
                        if (output_buf) {
                                fwrite(output_buf, 1, output_len, outfile);
+                               fflush(outfile);
                                g_free(output_buf);
                        }
                }
@@ -638,6 +639,7 @@ static void datafeed_in(struct sr_dev *dev, struct sr_datafeed_packet *packet)
                                        &output_buf, &output_len);
                        if (output_buf) {
                                fwrite(output_buf, 1, output_len, outfile);
+                               fflush(outfile);
                                g_free(output_buf);
                        }
                }
@@ -652,6 +654,7 @@ static void datafeed_in(struct sr_dev *dev, struct sr_datafeed_packet *packet)
                                         &output_len);
                        if (output_buf) {
                                fwrite(output_buf, 1, output_len, outfile);
+                               fflush(outfile);
                                g_free(output_buf);
                        }
                }
@@ -664,6 +667,7 @@ static void datafeed_in(struct sr_dev *dev, struct sr_datafeed_packet *packet)
                                         &output_len);
                        if (output_buf) {
                                fwrite(output_buf, 1, output_len, outfile);
+                               fflush(outfile);
                                g_free(output_buf);
                        }
                }
@@ -923,6 +927,7 @@ void show_pd_annotations(struct srd_proto_data *pdata, void *cb_data)
        for (i = 0; annotations[i]; i++)
                printf("\"%s\" ", annotations[i]);
        printf("\n");
+       fflush(stdout);
 }
 
 static int select_probes(struct sr_dev *dev)