This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: when is os.posix_spawn(setsid=True) safe?
Type: enhancement Stage:
Components: IO Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: cagney, methane, nanjekyejoannah, pablogsal, serhiy.storchaka, vstinner
Priority: normal Keywords:

Created on 2019-04-12 17:58 by cagney, last changed 2022-04-11 14:59 by admin.

Messages (3)
msg340091 - (view) Author: cagney (cagney) Date: 2019-04-12 17:58
How can I detect that os.posix_spawn(setsid=True) is available at runtime?

I'd like to use os.posix_spawn(setsid=True) when it is available, and  (assuming I'm getting this right) os.posix_spawn(setpgroup=0) as a poor fallback.
msg340248 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-04-15 09:41
Maybe we need to expose an object in the os module to list which parameters are supported. setsid is not argument, but scheduler is another argument. There is also a discussion to add another argument to os.posix_spawn() to specify the working directly: it's not possible on all platforms neither.

Currently, there are os.supports_* constants like os.supports_dir_fd (set of function names). But I would prefer to have an object just for posix_spawn. Maybe:

os.supported_posix_spawn_args = ('file_actions', setpgroup', 'resetids', 'setsid', 'setsigmark', 'setsigdef', 'scheduler')

The value would depend depending on the platform.
msg340249 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-04-15 09:42
Hum, os.supports_posix_spawn_args name would be more consistent with os.supports_dir_fd name.
History
Date User Action Args
2022-04-11 14:59:13adminsetgithub: 80800
2019-04-15 09:42:02vstinnersetmessages: + msg340249
2019-04-15 09:41:12vstinnersetnosy: + methane, serhiy.storchaka, pablogsal
messages: + msg340248
2019-04-14 21:21:38nanjekyejoannahsetnosy: + vstinner, nanjekyejoannah
2019-04-12 17:58:10cagneycreate