diff --git a/clients/client-linux.py b/clients/client-linux.py index 010ca9e..af23c85 100755 --- a/clients/client-linux.py +++ b/clients/client-linux.py @@ -168,7 +168,10 @@ def _ping_thread(host, mark): startTime = time.time() output.readline() while True: - if 'ttl' not in output.readline(): + buffer = output.readline() + if len(buffer) == 0: + return + if 'ttl' not in buffer: lostCount += 1 allCount += 1 # 防止吓人 diff --git a/clients/client-psutil.py b/clients/client-psutil.py index cf783a5..194bef0 100755 --- a/clients/client-psutil.py +++ b/clients/client-psutil.py @@ -137,7 +137,10 @@ def _ping_thread(host, mark): output.readline() output.readline() while True: - if 'TTL' not in output.readline().upper(): + buffer = output.readline() + if len(buffer) == 0: + return + if 'TTL' not in buffer.upper(): lostCount += 1 allCount += 1 # 防止吓人