Fix pickling issue in file_writer on macOS

This commit is contained in:
Marcin Kulik
2022-05-02 23:08:08 +02:00
parent 32b6cfa646
commit fb35f0bf86
2 changed files with 6 additions and 2 deletions

View File

@@ -11,7 +11,7 @@ class file_writer:
) -> None:
self.path = path
self.file: Optional[IO[Any]] = None
self.on_error = on_error or (lambda _x: None)
self.on_error = on_error or noop
def __enter__(self) -> Any:
self._open_file()
@@ -38,3 +38,7 @@ class file_writer:
else:
self.on_error("Output pipe broken")
raise e
def noop(_: Any) -> None:
return None

View File

@@ -55,7 +55,7 @@ def record( # pylint: disable=too-many-arguments,too-many-locals
)
sync_writer = writer(
path_, metadata, append, on_error=_notifier.notify
path_, metadata, append, on_error=_notifier.queue.put
)
with async_writer(sync_writer, time_offset, record_stdin) as _writer: