Commit Graph

283 Commits

Author SHA1 Message Date
Hugo van Kemenade f0c58c6475
[3.11] gh-101100: Fix Sphinx warnings in `whatsnew/2.7.rst` and related (GH-115319) (#115331) 2024-02-12 16:37:28 +02:00
Miss Islington (bot) b833b00482
[3.11] gh-114913: Add newline to subprocess doc (GH-114941) (#114943)
*creationflags* is a separate topic from *startupinfo*.
Start sentence with 'If given', like previous sentence.
(cherry picked from commit 1183f1e6bf)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-02-02 23:22:03 +00:00
Erlend E. Aasland eb94a0426f
[3.11] Docs: align usage of versionadded/versionchanged with recommended practice (#114409) (#114473)
(cherry picked from commit 1d7bddd961)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2024-01-23 10:39:25 +01:00
Miss Islington (bot) 2a4a724cdf
[3.11] gh-101100: Fix Sphinx warnings for 2.6 deprecations and removals (GH-113725) (#113735)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2024-01-05 16:02:07 +02:00
Miss Islington (bot) f35322502a
[3.11] [doc] Make subprocess.wait documentation more precise (GH-98700) (#112154)
[doc] Make subprocess.wait documentation more precise (GH-98700)

[doc] Make subprocess.wait doc more precise

An active loop is only used when the `timeout` parameter is used on
POSIX.

When no timeout is used, the code calls `os.waitpid` internally (which puts
the process on a sleep status). On Windows, the internal Windows API
call accepts a timeout parameter, so that is delegated to the OS.
(cherry picked from commit 81ab0e8a4a)

Co-authored-by: Luis Pedro Coelho <luis@luispedro.org>
2023-12-13 12:01:36 -08:00
Ezio Melotti 07471cda29
[3.11] gh-110631: Fix reST indentation in `Doc/library` (GH-110685) (#110737)
* [3.11] gh-110631: Fix reST indentation in `Doc/library` (GH-110685)

Fix wrong indentation in the Doc/library dir..
(cherry picked from commit bb7923f556)

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>

* Fix merge glitch.
2023-10-11 23:11:41 +02:00
Gregory P. Smith 6ba1234c1c
[3.11] gh-104372: Drop the GIL around the vfork() call. (#104782) (#104958)
gh-104372: Drop the GIL around the vfork() call. (#104782)

On Linux where the `subprocess` module can use the `vfork` syscall for
faster spawning, prevent the parent process from blocking other threads
by dropping the GIL while it waits for the vfork'ed child process `exec`
outcome.  This prevents spawning a binary from a slow filesystem from
blocking the rest of the application.

Fixes #104372.

(cherry picked from commit d08679212d)
2023-09-01 08:53:06 +00:00
Miss Islington (bot) c3432523d1
[3.11] gh-107091: Fix some uses of :const: role (GH-107379) (GH-107385)
It is for references, not for literals.
(cherry picked from commit 0aa58fa7a6)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-07-28 10:36:19 +00:00
Serhiy Storchaka cc76113cf8
[3.11] gh-106892: Use roles :data: and :const: for referencing module variables (GH-106894) (GH-106955)
(cherry picked from commit d036db728e)
2023-07-21 14:49:21 +03:00
Miss Islington (bot) 05a25867ae
[3.11] gh-87452: Improve the Popen.returncode docs (#103771)
Clarifies that it remains None until a method checking the child process
status has been called and noticed it has terminated.
(cherry picked from commit 68f5836582)

Co-authored-by: Joshua Herman <30265+zitterbewegung@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2023-04-25 18:15:48 +02:00
Miss Islington (bot) 6829b1256a
[3.11] Fixes duplicated word (GH-102623) (#102624)
Fixes duplicated word (GH-102623)

In line 1627, the end of the sentence reads "only that that it may be." but it should read "only that it may be" (or alternatively "only that that may be").

(cherry picked from commit e6210621be)

Co-authored-by: Guido van Rossum <guido@python.org>
Co-authored-by: Hugo Gabriel Eyherabide <hugogabriel.eyherabide@gmail.com>
2023-03-12 10:00:04 -07:00
Miss Islington (bot) 4a9dff0e5a
gh-101283: Version was just released, so should be changed in 3.11.3 (GH-101719)
(cherry picked from commit 0e0c5d8baa)

Co-authored-by: Steve Dower <steve.dower@python.org>
2023-02-08 16:11:36 -08:00
Miss Islington (bot) 51b079a2d6
Update Lib/subprocess.py 2023-02-08 15:44:06 -08:00
Miss Islington (bot) 7240ba7f94
[3.11] gh-47937: Note that Popen attributes are read-only (GH-93070) (#101684)
* Note that Popen attributes aren't meant to be set by users by rewording the text about the attributes.
* Also update some universal_newlines references to mention the modern text parameter name while in the area.

(cherry picked from commit 027adf42cd)

Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-02-08 11:03:56 +01:00
Miss Islington (bot) 80013d78e0
[Minor PR] Quotes in documentation changed into code blocks (GH-99536)
Minor formatting fix in documentation

(cherry picked from commit efccd04b9e)

Co-authored-by: Bart Broere <mail@bartbroere.eu>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-12-24 12:26:11 -08:00
Miss Islington (bot) 00147a84fc
gh-99238: clarify the type of the env dict. (GH-99253)
(cherry picked from commit 2eee9d9cd7)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-11-08 13:09:04 -08:00
Hugo van Kemenade 095e06f4ca
[3.11] Docs: Bump sphinx-lint and use double backticks for inline literals (GH-98441) (#98445)
Bump sphinx-lint and use double backticks for inline literals
2022-10-20 06:07:33 -07:00
Miss Islington (bot) cdc01eaed9
gh-87597: Document TimeoutExpired.stdout & .stderr types (GH-97685)
This documents the behavior that has always been the case since timeout
support was introduced in Python 3.3.
(cherry picked from commit b05dd79649)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-09-30 10:54:12 -07:00
Miss Islington (bot) 72cad6cfe5
gh-95451: Update docs for wasm32-emscripten and -wasi platforms (GH-95452)
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
(cherry picked from commit e3b6ff19aa)

Co-authored-by: Christian Heimes <christian@python.org>
2022-08-02 12:13:07 -07:00
Christian Heimes 9af9ea28e7
[3.11] gh-95415: Make availability directive consistent (GH-95416) (GH-95438)
Co-authored-by: Christian Heimes <christian@python.org>
2022-08-01 14:26:19 +02:00
Miss Islington (bot) 77bf973930
Docs: remove redundant "adverb-adjective" hyphens from compound modifiers (GH-94551) (GH-94557)
Discussion: https://discuss.python.org/t/slight-grammar-fix-throughout-adverbs-dont-need-hyphen/17021
(cherry picked from commit 3440d197a5)

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
2022-07-05 14:30:19 +02:00
Miss Islington (bot) de97d8229c
gh-92417: `subprocess` docs: remove note on compatibility with Python <3.5 (GH-92538) (GH-92972)
(cherry picked from commit 84b86000e2)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-05-19 17:56:04 +02:00
Gregory P. Smith f6dd14c653
gh-82616: Add process_group support to subprocess.Popen (#23930)
One more thing that can help prevent people from using `preexec_fn`.

Also adds conditional skips to two tests exposing ASAN flakiness on the Ubuntu 20.04 Address Sanitizer Github CI system. When that build is run on more modern systems the "problem" does not show up. It seems ASAN implementation related.

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-05-05 16:22:32 -07:00
slateny 567be058b4
gh-87801: Add run() to subprocess.CalledProcessError description (#91628) 2022-04-30 15:32:00 -06:00
Inada Naoki 354ace8b07
gh-91954: Emit EncodingWarning from locale and subprocess (GH-91977)
locale.getpreferredencoding() and subprocess.Popen() emit EncodingWarning
2022-04-30 15:53:29 +09:00
Gregory P. Smith cd5726fe67
gh-91401: Add a failsafe way to disable vfork. (#91490)
Just in case there is ever an issue with _posixsubprocess's use of
vfork() due to the complexity of using it properly and potential
directions that Linux platforms where it defaults to on could take, this
adds a failsafe so that users can disable its use entirely by setting
a global flag.

No known reason to disable it exists. But it'd be a shame to encounter
one and not be able to use CPython without patching and rebuilding it.

See the linked issue for some discussion on reasoning.

Also documents the existing way to disable posix_spawn.
2022-04-25 16:19:39 -07:00
Kumar Aditya dd69f73421
bpo-26897: Clarify Popen stdin, stdout, stderr file object docs (GH-30231) 2022-02-25 08:41:19 -08:00
DonnaDia 19a304ba99
bpo-24888: Clarify subprocess.check_call propagates exceptions if unable to start process (GH-28018) 2021-09-07 20:16:44 +02:00
Anthony Shaw c5c5326d47
bpo-39498 Start linking the security warnings in the stdlib modules (GH-18272)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-08-10 00:35:51 +02:00
Jack DeVries 7d25254cf0
bpo-44713: [doc fix]: typo in subprocess.rst (GH-27297)
This fixes a small typo. The code fragment should not be quoted. Thank you
@merwok for the feedback.
2021-07-22 16:06:18 -07:00
Jack DeVries 50ffbe3daf
bpo-14879: [doc] clarify how to check for errors from subprocess.Popen(..., shell=True) (GH-26755) 2021-07-22 19:23:29 +01:00
uniocto 5f2eb87f28
bpo-23750: Document os-system, subprocess. Patch by Martin Panter. (GH-26016)
* Document os-system, subprocess Patch

* Update Doc/library/os.rst

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-05-11 13:47:05 -07:00
andrei kulakov ea39f82b97
Fix a typo in subprocess documentation (GH-25426)
Fix a typo per conversation with vstinner on IRC: in posix => on posix.
2021-04-17 11:59:18 +02:00
Gregory P. Smith 64abf37344
bpo-42388: Fix subprocess.check_output input=None when text=True (GH-23467)
When the modern text= spelling of the universal_newlines= parameter was added
for Python 3.7, check_output's special case around input=None was overlooked.
So it behaved differently with universal_newlines=True vs text=True.  This
reconciles the behavior to be consistent and adds a test to guarantee it.

Also clarifies the existing check_output documentation.

Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
2020-12-24 20:57:21 -08:00
Andre Delfino dcc997cd28
[doc] Fix erroneous backslashes in signatures and names (GH-23658)
The issue being resolved is shown in the 3.10 docs (if you select docs for older versions you won't see a visual glitch).

The newer sphinx version that produces the 3.10 docs doesn't treat the backslash to escape things in some situations it previously did.
2020-12-16 17:37:28 -08:00
sblondon da431f789b
Add two spaces around equal sign (#23719)
Fit to PEP8 coding style
2020-12-12 21:27:22 -08:00
Ammar Askar f9a8386e44
bpo-40932: Note security caveat of shlex.quote on Windows (GH-21502)
Added a note in the `subprocess` docs that recommend using `shlex.quote` without mentioning that this is only applicable to Unix. 

Also added a warning straight into the `shlex` docs since it only says "for simple syntaxes resembling that of the Unix shell" and says using `quote` plugs the security hole without mentioning this important caveat.
2020-11-10 23:29:56 -08:00
Paul Moore 5ab27cc518
bpo-42041: Clarify how subprocess searches for the executable (GH-22715)
Clarify in the subprocess documentation how searching for the executable to run works, noting that ``sys.executable`` is the recommended way to find the current interpreter.
2020-10-20 21:02:24 +01:00
Ruben Vorderman 23c0fb8edd
bpo-41586: Add pipesize parameter to subprocess & F_GETPIPE_SZ and F_SETPIPE_SZ to fcntl. (GH-21921)
* Add F_SETPIPE_SZ and F_GETPIPE_SZ to fcntl module
* Add pipesize parameter for subprocess.Popen class

This will allow the user to control the size of the pipes.
On linux the default is 64K. When a pipe is full it blocks for writing.
When a pipe is empty it blocks for reading. On processes that are
very fast this can lead to a lot of wasted CPU cycles. On a typical
Linux system the max pipe size is 1024K which is much better.
For high performance-oriented libraries such as xopen it is nice to
be able to set the pipe size.

The workaround without this feature is to use my_popen_process.stdout.fileno() in
conjuction with fcntl and 1031 (value of F_SETPIPE_SZ) to acquire this behavior.
2020-10-19 16:30:02 -07:00
Gareth Rees bf2e515fa4
bpo-40707: Document that Popen.communicate sets the returncode attribute (GH-20283) 2020-06-23 23:12:10 -04:00
Mathieu Dupuy 65460565df
Doc: change 'Posix' for 'POSIX' (GH-20001) 2020-05-17 23:29:51 +02:00
Zackery Spytz 46545000c2
bpo-39976: Add **other_popen_kwargs to subprocess docs (GH-20145)
Patch by Zackery Spytz.
2020-05-17 03:52:47 -07:00
Tim D. Smith 95d024d585
bpo-13826: Clarify Popen constructor example (GH-18438)
Clarifies that the use of `shlex.split` is more instructive than
normative, and provides a simpler example.





https://bugs.python.org/issue13826
2020-02-10 14:51:01 -08:00
Victor Stinner e85a305503
bpo-38630: Fix subprocess.Popen.send_signal() race condition (GH-16984)
On Unix, subprocess.Popen.send_signal() now polls the process status.
Polling reduces the risk of sending a signal to the wrong process if
the process completed, the Popen.returncode attribute is still None,
and the pid has been reassigned (recycled) to a new different
process.
2020-01-15 17:38:55 +01:00
Jules Lasne (jlasne) f25875af42 Added missing coma after end of list in subprocess.rst (GH-17217)
Automerge-Triggered-By: @csabella
2019-11-19 04:14:53 -08:00
Gregory P. Smith f3751efb5c
bpo-38417: Add umask support to subprocess (GH-16726)
On POSIX systems, allow the umask to be set in the child process before we exec.
2019-10-12 13:24:56 -07:00
Patrick McLean 2b2ead7438 bpo-36046: Add user and group parameters to subprocess (GH-11950)
* subprocess: Add user, group and extra_groups paremeters to subprocess.Popen

This adds a `user` parameter to the Popen constructor that will call
setreuid() in the child before calling exec(). This allows processes
running as root to safely drop privileges before running the subprocess
without having to use a preexec_fn.

This also adds a `group` parameter that will call setregid() in
the child process before calling exec().

Finally an `extra_groups` parameter was added that will call
setgroups() to set the supplimental groups.
2019-09-12 18:15:44 +01:00
Tim Hoffmann 1a13efb7e0 Minor ReST formatting fixes in subprocess docs (#14876) 2019-09-11 13:26:31 +02:00
Christian Heimes 98d90f745d
bpo-37951: Lift subprocess's fork() restriction (GH-15544) 2019-08-27 23:36:56 +02:00
David Jones 6a61714cde Replace backquote with command substitution in subprocess doc example (GH-13941)
Replace backquotes with POSIXy command substitution in example.
2019-07-16 07:55:19 -07:00