summaryrefslogtreecommitdiffstats
path: root/Doc/library/subprocess.rst
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-05-28 19:49:35 (GMT)
committerGitHub <noreply@github.com>2019-05-28 19:49:35 (GMT)
commit9e3c4526394856d6376eed4968d27d53e1d69b7d (patch)
tree709efb00303c937b13b77cec4e2d510d5f15811c /Doc/library/subprocess.rst
parent1b05aa219041eb1c9dbcb4ec6c1fa5b20f060bf5 (diff)
downloadcpython-9e3c4526394856d6376eed4968d27d53e1d69b7d.zip
cpython-9e3c4526394856d6376eed4968d27d53e1d69b7d.tar.gz
cpython-9e3c4526394856d6376eed4968d27d53e1d69b7d.tar.bz2
bpo-31961: Fix support of path-like executables in subprocess. (GH-5914)
Diffstat (limited to 'Doc/library/subprocess.rst')
-rw-r--r--Doc/library/subprocess.rst29
1 files changed, 26 insertions, 3 deletions
diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst
index d840b46..ede5c3c 100644
--- a/Doc/library/subprocess.rst
+++ b/Doc/library/subprocess.rst
@@ -347,7 +347,8 @@ functions.
the class uses the Windows ``CreateProcess()`` function. The arguments to
:class:`Popen` are as follows.
- *args* should be a sequence of program arguments or else a single string.
+ *args* should be a sequence of program arguments or else a single string
+ or :term:`path-like object`.
By default, the program to execute is the first item in *args* if *args* is
a sequence. If *args* is a string, the interpretation is
platform-dependent and described below. See the *shell* and *executable*
@@ -381,6 +382,15 @@ functions.
manner described in :ref:`converting-argument-sequence`. This is because
the underlying ``CreateProcess()`` operates on strings.
+ .. versionchanged:: 3.6
+ *args* parameter accepts a :term:`path-like object` if *shell* is
+ ``False`` and a sequence containing path-like objects on POSIX.
+
+ .. versionchanged:: 3.8
+ *args* parameter accepts a :term:`path-like object` if *shell* is
+ ``False`` and a sequence containing bytes and path-like objects
+ on Windows.
+
The *shell* argument (which defaults to ``False``) specifies whether to use
the shell as the program to execute. If *shell* is ``True``, it is
recommended to pass *args* as a string rather than as a sequence.
@@ -436,6 +446,13 @@ functions.
:program:`ps`. If ``shell=True``, on POSIX the *executable* argument
specifies a replacement shell for the default :file:`/bin/sh`.
+ .. versionchanged:: 3.6
+ *executable* parameter accepts a :term:`path-like object` on POSIX.
+
+ .. versionchanged:: 3.8
+ *executable* parameter accepts a bytes and :term:`path-like object`
+ on Windows.
+
*stdin*, *stdout* and *stderr* specify the executed program's standard input,
standard output and standard error file handles, respectively. Valid values
are :data:`PIPE`, :data:`DEVNULL`, an existing file descriptor (a positive
@@ -492,13 +509,19 @@ functions.
The *pass_fds* parameter was added.
If *cwd* is not ``None``, the function changes the working directory to
- *cwd* before executing the child. *cwd* can be a :class:`str` and
+ *cwd* before executing the child. *cwd* can be a string, bytes or
:term:`path-like <path-like object>` object. In particular, the function
looks for *executable* (or for the first item in *args*) relative to *cwd*
if the executable path is a relative path.
.. versionchanged:: 3.6
- *cwd* parameter accepts a :term:`path-like object`.
+ *cwd* parameter accepts a :term:`path-like object` on POSIX.
+
+ .. versionchanged:: 3.7
+ *cwd* parameter accepts a :term:`path-like object` on Windows.
+
+ .. versionchanged:: 3.8
+ *cwd* parameter accepts a bytes object on Windows.
If *restore_signals* is true (the default) all signals that Python has set to
SIG_IGN are restored to SIG_DFL in the child process before the exec.