Skip to content

Commit 9b70bc7

Browse files
Merge pull request #165 from dotflow-io/feature/141
🪲 BUG-#141: Fix fork multiprocessing on macOS with OBJC safety flag
2 parents 810264c + bccb781 commit 9b70bc7

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

dotflow/core/workflow.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,18 @@
1616
from dotflow.core.types import TypeExecution, TypeStatus
1717
from dotflow.utils import basic_callback
1818

19-
_mp = get_context("fork") if sys.platform != "win32" else get_context("spawn")
19+
if sys.platform == "win32":
20+
_mp = get_context("spawn")
21+
else:
22+
import multiprocessing
23+
24+
if sys.platform == "darwin" and hasattr(
25+
multiprocessing, "set_forkserver_preload"
26+
):
27+
import os
28+
29+
os.environ.setdefault("OBJC_DISABLE_INITIALIZE_FORK_SAFETY", "YES")
30+
_mp = get_context("fork")
2031

2132

2233
def grouper(tasks: list[Task]) -> dict[str, list[Task]]:

0 commit comments

Comments
 (0)