From 92485497444b2e402c08e80b9d4a3efa282c8a82 Mon Sep 17 00:00:00 2001 From: madrigal Date: Fri, 17 Oct 2025 09:55:44 -0400 Subject: [PATCH] Passing error messages to log file --- iperf/iperf_functions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/iperf/iperf_functions.py b/iperf/iperf_functions.py index d15a368..92f4afd 100644 --- a/iperf/iperf_functions.py +++ b/iperf/iperf_functions.py @@ -91,10 +91,12 @@ def collect_iperf( if result.returncode != 0: print(f"Error running iperf3: {result.stderr}") output = "" + error = result.stderr except subprocess.TimeoutExpired: print(f"iPerf test timed out after {timeout} seconds.") output = "" + error = f"iPerf test timed out after {timeout} seconds." sender_bitrate, receiver_bitrate = parse_iperf_output(output) @@ -113,7 +115,7 @@ def collect_iperf( "stations": stations, } if output == "": - data["error"] = f"Test exceeded timeout of {timeout}s" + data["error"] = error else: print(f"\n{server_ip} {test_type} IPERF complete") print(f"IPERF sender bitrate: {sender_bitrate}")