Warn if doing JSON output and either -d or -v are specified.
Debugging and/or verbose output can get in the way of producing
valid/parsable JSON.
Inspired by #737.
diff --git a/src/iperf_api.c b/src/iperf_api.c
index 58d4479..8b65d23 100755
--- a/src/iperf_api.c
+++ b/src/iperf_api.c
@@ -1231,6 +1231,14 @@
warning("Report format (-f) flag ignored with JSON output (-J)");
}
+ /* Show warning if JSON output is used with verbose or debug flags */
+ if (test->json_output && test->verbose) {
+ warning("Verbose output (-v) may interfere with JSON output (-J)");
+ }
+ if (test->json_output && test->debug) {
+ warning("Debug output (-d) may interfere with JSON output (-J)");
+ }
+
return 0;
}