Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
Description
Feature or enhancement
Proposal:
macOS supports a non-standardposix_spawn()
flag,POSIX_SPAWN_CLOEXEC_DEFAULT
, which makes "only file descriptors explicitly created by the file_actions argument available in the spawned process; all of the other file descriptors are automatically closed in the spawned process."
This would be useful forsubprocess
, whereclose_fds
defaulting to True means thatposix_spawn()
is not used by default.POSIX_SPAWN_CLOEXEC_DEFAULT
combined with (the also non-standard)posix_spawn_file_actions_addinherit_np()
would provide a correct way to useposix_spawn()
whenclose_fds=True
.
AChromium bug indicates thatPOSIX_SPAWN_CLOEXEC_DEFAULT
was added in OS X 10.7 but causes kernel panics there, for safety this should probably only be used on OS X 10.8 and later.
This could be added as acloexec_default=False
argument toos.posix_spawn()
andos.posix_spawnp()
.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
#79718 was the original issue for usingos.posix_spawn()
insubprocess
.
#86904 proposed changingclose_fds
to default to False, soposix_spawn()
could be used more often