| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
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.
|
|
|
| |
Fit to PEP8 coding style
|
|
|
|
|
| |
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.
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
(GH-20283)
|
| |
|
|
|
|
| |
Patch by Zackery Spytz.
|
|
|
|
|
|
|
|
|
|
| |
Clarifies that the use of `shlex.split` is more instructive than
normative, and provides a simpler example.
https://bugs.python.org/issue13826
|
|
|
|
|
|
|
| |
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.
|
|
|
| |
Automerge-Triggered-By: @csabella
|
|
|
|
| |
On POSIX systems, allow the umask to be set in the child process before we exec.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
| |
|
| |
|
|
|
| |
Replace backquotes with POSIXy command substitution in example.
|
|
|
| |
Also updates some (unreleased) event names to be consistent with the others.
|
| |
|
| |
|
|
|
| |
Clarify how to capture stdout and stderr combined into one stream.
|
|
|
|
|
| |
Document that subprocess.Popen no longer raise an exception on error
like missing program on very specific platforms when using
os.posix_spawn() is used.
|
|
|
|
|
| |
Clarify capturing or suppressing stdout and stderr on the old call APIs.
Do not state that they are equivalent to run() calls when they are not implemented using run as that was misleading. Unlike run they cannot handle stdout or stderr being set to PIPE without a risk of deadlock.
|
| |
|
|
|
|
| |
is available with the parent process (GH-11422)
|
|
|
|
|
|
|
|
| |
* universal_newlines defaulting to False would suggest, that not
specifying universal_newlines explicitly and setting text to True
should cause an error, which is not the case.
* The run function didn't have the universal_newlines parameter
documented
* The check_output function didn't have its text parameter documented
|
|
|
|
|
|
| |
Replace "Availability: xxx" with ".. availability:: xxx" in the doc.
Original patch by Georg Brandl.
Co-Authored-By: Georg Brandl <georg@python.org>
|
|
|
| |
Make it more accurate and not limited to UNIX.
|
| |
|
|
|
|
|
|
| |
uniformity. (GH8114)
Per the recommendation in our Developer's Guide:
https://devguide.python.org/documenting/#paragraph-level-markup
|
| |
|
|
|
| |
Clarify the subprocess documentation.
|
|
|
|
|
|
| |
* Revert "bpo-31961: subprocess now accepts path-like args (GH-4329)"
This reverts commit dd42cb71f2cb02f3a32f016137b12a146bc0d0e2.
|
|
|
| |
Describe *text* as an alias for *universal_newlines* in more places that people are likely to be referred to.
|
|
|
| |
Fixes the documentation for `subprocess.check_output()` not mentioning that the encoding and errors parameters were added in 3.6.
|
|
|
| |
Allow os.PathLike args in subprocess APIs.
|
|
|
|
| |
Add "capture_output=True" option to subprocess.run, this is equivalent to
setting stdout=PIPE, stderr=PIPE but is much more readable.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Windows (#1218)
Even though Python marks any handles it opens as non-inheritable there
is still a race when using `subprocess.Popen` since creating a process
with redirected stdio requires temporarily creating inheritable handles.
By implementing support for `subprocess.Popen(close_fds=True)` we fix
this race.
In order to implement this we use PROC_THREAD_ATTRIBUTE_HANDLE_LIST
which is available since Windows Vista. Which allows to pass an explicit
list of handles to inherit when creating a process.
This commit also adds `STARTUPINFO.lpAttributeList["handle_list"]`
which can be used to control PROC_THREAD_ATTRIBUTE_HANDLE_LIST
directly.
|
| |
|
|
|
|
|
|
|
|
|
| |
Improve human friendliness of the Popen API: Add text=False as a
keyword-only argument to subprocess.Popen along with a Popen
attribute .text_mode and set this based on the
encoding/errors/universal_newlines/text arguments.
The universal_newlines parameter and attribute are maintained for
backwards compatibility.
|
|
|
|
|
| |
The `subprocess.getstatusoutput` API was inadvertently changed
in Python 3.3.4. Document the change, it is too late to undo the
API change now as it has shipped in many stable releases.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Partially clarify the subprocess convenience API documentation by
explicitly listing the `cwd` parameter in their abbreviated signatures.
While this has been merged as an improvement, it doesn't fully
resolve the issue, as the `cwd` should also be covered in the
"Frequently Used Arguments" section, and the fact these APIs
pass unlisted keyword arguments down to the lower level APIs
is currently still unclear.
|
|
|
|
| |
* Document STARTUPINFO constructor
* Move versionchanged directive to above of attributes
|
|
|
|
| |
PathLike objects (#157)
|
|
|
|
|
|
|
| |
The Windows-specific subprocess.STARTUPINFO class now accepts
keyword-only arguments to its constructor to set the various
data attributes.
Patch by Subhendu Ghosh.
|
| |
|
|\ |
|
| | |
|
|\ \
| |/ |
|