@@ -344,7 +344,7 @@ functions.
344
344
encoding=None, errors=None, text=None, pipesize=-1)
345
345
346
346
Execute a child program in a new process. On POSIX, the class uses
347
- :meth: `os.execvp `-like behavior to execute the child program. On Windows,
347
+ :meth: `os.execvpe `-like behavior to execute the child program. On Windows,
348
348
the class uses the Windows ``CreateProcess() `` function. The arguments to
349
349
:class: `Popen ` are as follows.
350
350
@@ -356,6 +356,25 @@ functions.
356
356
arguments for additional differences from the default behavior. Unless
357
357
otherwise stated, it is recommended to pass *args * as a sequence.
358
358
359
+ .. warning ::
360
+
361
+ For maximum reliability, use a fully-qualified path for the executable.
362
+ To search for an unqualified name on :envvar: `PATH `, use
363
+ :meth: `shutil.which `. On all platforms, passing :data: `sys.executable `
364
+ is the recommended way to launch the current Python interpreter again,
365
+ and use the ``-m `` command-line format to launch an installed module.
366
+
367
+ Resolving the path of *executable * (or the first item of *args *) is
368
+ platform dependent. For POSIX, see :meth: `os.execvpe `, and note that
369
+ when resolving or searching for the executable path, *cwd * overrides the
370
+ current working directory and *env * can override the ``PATH ``
371
+ environment variable. For Windows, see the documentation of the
372
+ ``lpApplicationName `` and ``lpCommandLine `` parameters of WinAPI
373
+ ``CreateProcess ``, and note that when resolving or searching for the
374
+ executable path with ``shell=False ``, *cwd * does not override the
375
+ current working directory and *env * cannot override the ``PATH ``
376
+ environment variable. Using a full path avoids all of these variations.
377
+
359
378
An example of passing some arguments to an external program
360
379
as a sequence is::
361
380
@@ -524,7 +543,7 @@ functions.
524
543
525
544
If *cwd * is not ``None ``, the function changes the working directory to
526
545
*cwd * before executing the child. *cwd * can be a string, bytes or
527
- :term: `path-like <path-like object> ` object. In particular , the function
546
+ :term: `path-like <path-like object> ` object. In POSIX , the function
528
547
looks for *executable * (or for the first item in *args *) relative to *cwd *
529
548
if the executable path is a relative path.
530
549
0 commit comments