[issue47027] subprocess.run(), subprocess.Popen() should accept file descriptor as cwd parameter

Gregory P. Smith report at bugs.python.org
Mon Mar 21 18:07:02 EDT 2022


Gregory P. Smith <greg at krypto.org> added the comment:

Basically you want it to call fchdir() instead of chdir() when passed a fd (integer) instead of a string/Path-like.  That makes sense and should be a reasonably straight forward set of changes to _posixsubprocess.c.

(A way to convert a fd into a Path-like object would _not_ work as that'd reintroduce the TOCTOU on the directory - that'd be a pathlib feature request anyways, not a subprocess one)

----------
stage:  -> needs patch
versions: +Python 3.11 -Python 3.10, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue47027>
_______________________________________


More information about the Python-bugs-list mailing list