From 99ca593c06ebf8b3d7e0f67cf18ddfcdeba717be Mon Sep 17 00:00:00 2001 From: Aryan Singh Date: Sun, 13 Sep 2026 16:14:49 -0500 Subject: [PATCH] minor fix --- MP1/client.py | 8 +++++--- MP1/server.py | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/MP1/client.py b/MP1/client.py index 0f12fc3..e1cee3c 100644 --- a/MP1/client.py +++ b/MP1/client.py @@ -74,10 +74,11 @@ def grep_all_ips(ips, cmd, if_unit_test): #main #if unit test flag exists, then use the test log files instead of the actual log files -cmd = ["grep ", *[arg for arg in sys.argv[1:] if arg != "-t"]] +cmd = ["grep", *[arg for arg in sys.argv[1:] if arg != "-t"]] #track time start_time = time.perf_counter() -match_count = grep_all_ips(ALL_IPS, cmd, if_unit_test=[x for x in sys.argv].count("-t") > 0) +is_unit_test = "-t" in sys.argv +match_count = grep_all_ips(ALL_IPS, cmd, if_unit_test=is_unit_test) end_time = time.perf_counter() print("=========================== SUMMARY ===========================") @@ -92,6 +93,7 @@ for i, count in enumerate(match_count): print(f"machine.{i + 1}.test.log: {count} matches") else: print(f"machine.{i + 1}.log: {count} matches") -print(f"Total matches: {max(0, sum(match_count))}") +total_matches = sum(count for count in match_count if count > 0) +print(f"Total matches: {total_matches}") print("===============================================================") print(f"Time taken: {end_time - start_time:.2f} seconds") diff --git a/MP1/server.py b/MP1/server.py index 7810f75..1e51567 100644 --- a/MP1/server.py +++ b/MP1/server.py @@ -59,8 +59,7 @@ while True: send_message(conn, result.stdout + result.stderr) except Exception as e: - error_message = f"Error executing command: {e}" - send_message(conn, error_message) + None finally: conn.close()