SIGN IN SIGN UP

gh-118981: multiprocessing.popen_spawn_posix, fix potential hang (gh-118982)

fix potential hang.

It can happen that the child crashes right in the beginning for whatever reason. In this case, the parent will hang when writing into the pipe, because the child fd is not closed yet.

The normal pattern is to close the child fds right after the child proc is forked/executed/spawned, so when the child dies, then also the pipes will be closed, and there will be no hang (the parent gets SIGPIPE instead).
A
Albert Zeyer committed
8ed5a2b56cc6a8635e586c641b0b837669f6677b
Parent: c117b03
Committed by GitHub <noreply@github.com> on 9/7/2025, 7:18:28 AM