Skip to content

Commit b558f7f

Browse files
committed
guard execution of register_at_fork with a hasattr check
1 parent b1378a7 commit b558f7f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/zarr/core/sync.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ def reset_resources_after_fork() -> None:
101101
_executor = None
102102

103103

104-
os.register_at_fork(after_in_child=reset_resources_after_fork)
104+
# this is only available on certain operating systems
105+
if hasattr(os, "register_at_fork"):
106+
os.register_at_fork(after_in_child=reset_resources_after_fork)
105107

106108

107109
async def _runner(coro: Coroutine[Any, Any, T]) -> T | BaseException:

0 commit comments

Comments
 (0)