◐ Shell
reader mode source ↗
Skip to content

bpo-35537: subprocess can use posix_spawn with pipes#11575

Merged
vstinner merged 1 commit into
python:masterfrom
vstinner:subprocess_spawn2
Jan 23, 2019
Merged

bpo-35537: subprocess can use posix_spawn with pipes#11575
vstinner merged 1 commit into
python:masterfrom
vstinner:subprocess_spawn2

Conversation

@vstinner

@vstinner vstinner commented Jan 16, 2019

Copy link
Copy Markdown
Member
  • 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.

https://bugs.python.org/issue35537

@vstinner

Copy link
Copy Markdown
Member Author

Follow-up of PR #11452.

@vstinner

Copy link
Copy Markdown
Member Author

@vstinner

Copy link
Copy Markdown
Member Author

PR rebased on top of PR #11579 (commit 0785889).

@pablogsal pablogsal self-requested a review January 16, 2019 14:34
* 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.
@vstinner

Copy link
Copy Markdown
Member Author

PR rebased on top of PR #11579 (commit 0785889).

Since PR #11579, I rebased this PR again :-)

@vstinner

Copy link
Copy Markdown
Member Author

@gpshead @giampaolo: would you mind to review this change? It allows to use posix_spawn() in subprocess in much more cases.

@vstinner

Copy link
Copy Markdown
Member Author

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 :)

@bedevere-bot

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide comment

@giampaolo: So what do you think of the overall change? :-)

@giampaolo giampaolo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide comment

LGTM

@vstinner vstinner merged commit f6243ac into python:master Jan 23, 2019
@vstinner vstinner deleted the subprocess_spawn2 branch January 23, 2019 18:00
@vstinner

Copy link
Copy Markdown
Member Author

@giampaolo: "LGTM"

Yay! Thanks for the approval! I merged my PR.

@vstinner

Copy link
Copy Markdown
Member Author

@giampaolo: As I wrote, please open a new issue if you would like to enhance the new _close_pipe_fds() helper method.

@giampaolo

Copy link
Copy Markdown
Contributor

@vstinner here it is: #11686

gpshead pushed a commit that referenced this pull request Jan 29, 2019
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants