◐ Shell
clean mode source ↗

bpo-35537: subprocess can use posix_spawn with pipes by vstinner · Pull Request #11575 · python/cpython

izbyshev

izbyshev

* 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.

giampaolo

vstinner

giampaolo

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)