Skip to content

Commit a618b86

Browse files
committed
Enable write through as an alternative to fsync
1 parent 3c6b42e commit a618b86

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
@@ -330,6 +330,9 @@ def _setup_logging(self, log_dir: str) -> None:
330330
os.path.join(log_dir, LOG_NAME),
331331
mode='w', # Overwrite the log file
332332
)
333+
# Write through to avoid buffering the log file since the USB might be
334+
# removed at any time
335+
self.handler.stream.reconfigure(write_through=True)
333336
REL_TIME_FILTER.reset_time_reference() # type: ignore[union-attr]
334337
self.handler.setFormatter(TieredFormatter(
335338
fmt='[%(reltime)08.3f - %(levelname)s] %(message)s',

0 commit comments

Comments
 (0)