Skip to content

Add support for posix_spawn call in subprocess.Popen with close_fds=True #113117

Closed
@kulikjak

Description

@kulikjak

Feature or enhancement

Proposal:

One of the reasons posix_spawn is rarely used with subprocess functions is that it doesn't support close_fds=True (which is the default value).

Previously, it was deemed infeasible to support this (#79718 (comment)), but since then, posix_spawn_file_actions_addclosefrom_np() has become available on many systems (I know about Solaris, Linux and FreeBSD), which should make it pretty simple to support it.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

These two are related:
#79718 was the original issue for using os.posix_spawn() in subprocess.
#86904 proposed changing close_fds to default to False, so posix_spawn() could be used more often

Linked PRs

Metadata

Metadata

Assignees

Labels

3.13bugs and security fixestype-featureA feature request or enhancement

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions