From bba42bb95135e9d7c7707f625defd3dede75d460 Mon Sep 17 00:00:00 2001 From: pascolol Date: Mon, 19 Jan 2026 11:14:41 +0100 Subject: [PATCH] fix(format): use communicate rathan than .stdin.write to avoid dealocks due to any of the other OS pipe buffers filling up and blocking the child process --- src/datamodel_code_generator/format.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/datamodel_code_generator/format.py b/src/datamodel_code_generator/format.py index 5db7def3c..651f58fdd 100644 --- a/src/datamodel_code_generator/format.py +++ b/src/datamodel_code_generator/format.py @@ -404,7 +404,7 @@ def apply_ruff_check_and_format(self, code: str) -> str: ) if check_proc.stdout: # pragma: no branch check_proc.stdout.close() - check_proc.stdin.write(code.encode(self.encoding)) # type: ignore[union-attr] + check_proc.communicate(code.encode(self.encoding)) check_proc.stdin.close() # type: ignore[union-attr] stdout, _ = format_proc.communicate() check_proc.wait()