PEP 433: subprocess clears cloexec flag of pass_fds
This commit is contained in:
parent
2c9f128261
commit
f2ad21574e
11
pep-0433.txt
11
pep-0433.txt
|
@ -174,9 +174,6 @@ standard library. Third party modules not using the standard library
|
||||||
should be modified to conform to this PEP. The new
|
should be modified to conform to this PEP. The new
|
||||||
``os.set_cloexec()`` function can be used for example.
|
``os.set_cloexec()`` function can be used for example.
|
||||||
|
|
||||||
XXX Should ``subprocess.Popen`` clear the close-on-exec flag on file
|
|
||||||
XXX descriptors of the constructor the ``pass_fds`` parameter?
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
See `Close file descriptors after fork`_ for a possible solution
|
See `Close file descriptors after fork`_ for a possible solution
|
||||||
for ``fork()`` without ``exec()``.
|
for ``fork()`` without ``exec()``.
|
||||||
|
@ -229,6 +226,9 @@ The default value of the *cloexec* parameter is
|
||||||
Add a new command line option ``-e`` and an environment variable
|
Add a new command line option ``-e`` and an environment variable
|
||||||
``PYTHONCLOEXEC`` to the set close-on-exec flag by default.
|
``PYTHONCLOEXEC`` to the set close-on-exec flag by default.
|
||||||
|
|
||||||
|
``subprocess`` clears the close-on-exec flag of file descriptors of the
|
||||||
|
``pass_fds`` parameter.
|
||||||
|
|
||||||
All functions creating file descriptors in the standard library must
|
All functions creating file descriptors in the standard library must
|
||||||
respect the default *cloexec* parameter (``sys.getdefaultcloexec()``).
|
respect the default *cloexec* parameter (``sys.getdefaultcloexec()``).
|
||||||
|
|
||||||
|
@ -284,11 +284,6 @@ the default value of the *cloexec* parameter is ``True`` (instead of
|
||||||
If a file must be inherited by child processes, ``cloexec=False``
|
If a file must be inherited by child processes, ``cloexec=False``
|
||||||
parameter can be used.
|
parameter can be used.
|
||||||
|
|
||||||
``subprocess.Popen`` constructor has an ``pass_fds`` parameter to
|
|
||||||
specify which file descriptors must be inherited. The close-on-exec
|
|
||||||
flag of these file descriptors must be changed with
|
|
||||||
``os.set_cloexec()``.
|
|
||||||
|
|
||||||
Advantages of setting close-on-exec flag by default:
|
Advantages of setting close-on-exec flag by default:
|
||||||
|
|
||||||
* There are far more programs that are bitten by FD inheritance upon
|
* There are far more programs that are bitten by FD inheritance upon
|
||||||
|
|
Loading…
Reference in New Issue