diff --git a/psrecord/main.py b/psrecord/main.py index 1e324d7..66e07f8 100644 --- a/psrecord/main.py +++ b/psrecord/main.py @@ -274,7 +274,6 @@ def monitor( if include_io: f.write(f",{read_count},{write_count},{read_bytes},{write_bytes}") f.write("\n") - f.flush() if interval is not None: time.sleep(interval) @@ -296,6 +295,7 @@ def monitor( # close the logfile, if it's not stdout if logfile and logfile != "": + f.flush() f.close() if plot: