diff --git a/libbeat/tests/system/beat/beat.py b/libbeat/tests/system/beat/beat.py index d2a049f2634..9754a544224 100644 --- a/libbeat/tests/system/beat/beat.py +++ b/libbeat/tests/system/beat/beat.py @@ -200,6 +200,10 @@ def read_output(self, jsons = [] with open(os.path.join(self.working_dir, output_file), "r") as f: for line in f: + if len(line) == 0 or line[len(line)-1] != "\n": + # hit EOF + break + try: jsons.append(self.flatten_object(json.loads(line), [])) except: @@ -219,6 +223,10 @@ def read_output_json(self, output_file=None): jsons = [] with open(os.path.join(self.working_dir, output_file), "r") as f: for line in f: + if len(line) == 0 or line[len(line)-1] != "\n": + # hit EOF + break + jsons.append(json.loads(line)) return jsons