From 35b961c17b7a6dcbad98f4f3bfb9df115a28db29 Mon Sep 17 00:00:00 2001 From: Niklas Fiekas Date: Sun, 6 Aug 2023 10:47:25 +0200 Subject: [PATCH] Avoid start_new_session if possible --- chess/engine.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/chess/engine.py b/chess/engine.py index 5f50a1414..01ee08b3e 100644 --- a/chess/engine.py +++ b/chess/engine.py @@ -1180,7 +1180,11 @@ async def popen(cls: Type[ProtocolT], command: Union[str, List[str]], *, setpgrp popen_args["creationflags"] = popen_args.get("creationflags", 0) | subprocess.CREATE_NEW_PROCESS_GROUP # type: ignore except AttributeError: # Unix. - popen_args["start_new_session"] = True + if sys.version_info >= (3, 11): + popen_args["process_group"] = 0 + else: + # Before Python 3.11 + popen_args["start_new_session"] = True return await asyncio.get_running_loop().subprocess_exec(cls, *command, **popen_args)