From: Peter Stensmyr Date: Fri, 14 Dec 2018 15:01:50 +0000 (+1100) Subject: Fix multiprocessing support for Windows binary (#632) X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/fe24a15b84955130f23c8ab9490d1cdb98607b53?ds=inline;hp=0b40a7badf82c53c8a23b3a03273619f8440855d Fix multiprocessing support for Windows binary (#632) * Fix multiprocessing support for Windows binary The black and blackd binaries generated for Windows builds would fail on reformatting multiple files due to a Windows-specific multiprocessing issue. Fix by calling freeze_support() as described in Python docs. --- diff --git a/black.py b/black.py index c1cc080..8855c37 100644 --- a/black.py +++ b/black.py @@ -8,7 +8,7 @@ import io import itertools import keyword import logging -from multiprocessing import Manager +from multiprocessing import Manager, freeze_support import os from pathlib import Path import pickle @@ -3658,6 +3658,7 @@ def patch_click() -> None: def patched_main() -> None: + freeze_support() patch_click() main() diff --git a/blackd.py b/blackd.py index c5aa29c..1a3b369 100644 --- a/blackd.py +++ b/blackd.py @@ -2,6 +2,7 @@ import asyncio from concurrent.futures import Executor, ProcessPoolExecutor from functools import partial import logging +from multiprocessing import freeze_support from aiohttp import web import aiohttp_cors @@ -130,6 +131,7 @@ async def handle(request: web.Request, executor: Executor) -> web.Response: def patched_main() -> None: + freeze_support() black.patch_click() main()