Skip to content

Commit 0b6c460

Browse files
committed
Enable write through as an alternative to fsync
1 parent 2cdb35d commit 0b6c460

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

runusb/__main__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@ def _setup_logging(self, log_dir: str) -> None:
270270
os.path.join(log_dir, LOG_NAME),
271271
mode='w', # Overwrite the log file
272272
)
273+
# Write through to avoid buffering the log file since the USB might be
274+
# removed at any time
275+
self.handler.stream.reconfigure(write_through=True)
273276
REL_TIME_FILTER.reset_time_reference() # type: ignore[union-attr]
274277
self.handler.setFormatter(TieredFormatter(
275278
fmt='[%(reltime)08.3f - %(levelname)s] %(message)s',

0 commit comments

Comments
 (0)