10000 gh-88324: Clarify documentation for redirected stdout/stderr when using subprocess in Linux by richardhob · Pull Request #94035 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-88324: Clarify documentation for redirected stdout/stderr when using subprocess in Linux #94035

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 20, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update description of stdout, stderr, and stdin.
Changes:
- Move the ``None`` option (which is default) to the front of the list
  of input options
- Move the ``None`` option description up to make the default behavior
  more clear (No redirection)
- Remove mention of Child File Descriptors from ``None`` option description
  • Loading branch information
richardhob committed Jun 20, 2022
commit 7557ca7e1a8d7fd1d2ae27f2f443d255fa968f2a
32 changes: 15 additions & 17 deletions Doc/library/subprocess.rst
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,14 @@ default values. The arguments that are most commonly needed are:

*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
integer), an existing file object with a valid file descriptor, and ``None``.
:data:`PIPE` indicates that a new pipe to the child should be created.
:data:`DEVNULL` indicates that the special file :data:`os.devnull` will
be used. With the default settings of ``None``, no redirection will occur;
the child's file handles will be inherited from the parent.
Additionally, *stderr* can be :data:`STDOUT`, which indicates that the
stderr data from the child process should be captured into the same file
handle as for *stdout*.
are ``None``, :data:`PIPE`, :data:`DEVNULL`, an existing file descriptor (a
positive integer), and an existing :term:`file object` with a valid file
descriptor. With the default settings of ``None``, no redirection will
occur. :data:`PIPE` indicates that a new pipe to the child should be
created. :data:`DEVNULL` indicates that the special file :data:`os.devnull`
will be used. Additionally, *stderr* can be :data:`STDOUT`, which indicates
that the stderr data from the child process should be captured into the same
file handle as for *stdout*.

.. index::
single: universal newlines; subprocess module
Expand Down Expand Up @@ -482,15 +481,14 @@ functions.

*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
integer), an existing :term:`file object` with a valid file descriptor,
and ``None``. :data:`PIPE` indicates that a new pipe to the child should
be created. :data:`DEVNULL` indicates that the special file
:data:`os.devnull` will be used. With the default settings of ``None``,
no redirection will occur; the child's file handles will be inherited from
the parent. Additionally, *stderr* can be :data:`STDOUT`, which indicates
are ``None``, :data:`PIPE`, :data:`DEVNULL`, an existing file descriptor (a
positive integer), and an existing :term:`file object` with a valid file
descriptor. With the default settings of ``None``, no redirection will
occur. :data:`PIPE` indicates that a new pipe to the child should be
created. :data:`DEVNULL` indicates that the special file :data:`os.devnull`
will be used. Additionally, *stderr* can be :data:`STDOUT`, which indicates
that the stderr data from the applications should be captured into the same
file handle as for stdout.
file handle as for *stdout*.

If *preexec_fn* is set to a callable object, this object will be called in the
child process just before the child is executed.
Expand Down
0