bpo-35537: subprocess can use posix_spawn with pipes#11575
Conversation
Sorry, something went wrong.
Sorry, something went wrong.
* subprocess.Popen can now also use os.posix_spawn() with pipes if pipe file descriptors are greater than 2. * Fix Popen._posix_spawn(): set _child_created to True. * Add Popen._close_pipe_fds() helper function to factorize the code.
Sorry, something went wrong.
|
@gpshead @giampaolo: would you mind to review this change? It allows to use posix_spawn() in subprocess in much more cases. |
Sorry, something went wrong.
|
If I don't get any feedback before the end of the week, I will just merge my PR. I prefer to merge it early during the 3.8 development cycle, to get more time to fix it if something goes wrong :) |
Sorry, something went wrong.
|
When you're done making the requested changes, leave the comment: |
Sorry, something went wrong.
vstinner
left a comment
There was a problem hiding this comment.
@giampaolo: So what do you think of the overall change? :-)
Sorry, something went wrong.
giampaolo
left a comment
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
|
@giampaolo: "LGTM" Yay! Thanks for the approval! I merged my PR. |
Sorry, something went wrong.
|
@giampaolo: As I wrote, please open a new issue if you would like to enhance the new _close_pipe_fds() helper method. |
Sorry, something went wrong.
Sorry, something went wrong.
Close pipes/fds in subprocess by using ExitStack. "In case of premature failure on X.Close() or os.close(X) the remaining pipes/fds will remain "open". Perhaps it makes sense to use contextlib.ExitStack." - Rationale: #11575 (comment)
pipe file descriptors are greater than 2.
https://bugs.python.org/issue35537