summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2020-04-27 18:32:46 -0700
committerGitHub <noreply@github.com>2020-04-28 03:32:46 +0200
commit92e150ef5e309ff93378ae4538065f1ca5c00a17 (patch)
treef26947dd37927eb8ebec0ba35cd2c407ed5425b1 /docs
parentb20e8c05c749d1e2a5a2a1fb6b892318191d8575 (diff)
downloadpsutil-92e150ef5e309ff93378ae4538065f1ca5c00a17.tar.gz
psutil.Popen: inherit from subprocess + support wait(timeout=...) parameter (#1736)
Diffstat (limited to 'docs')
-rw-r--r--docs/index.rst27
1 files changed, 15 insertions, 12 deletions
diff --git a/docs/index.rst b/docs/index.rst
index 55e1586d..08a69555 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1966,15 +1966,8 @@ Popen class
A more convenient interface to stdlib `subprocess.Popen`_.
It starts a sub process and you deal with it exactly as when using
- `subprocess.Popen`_.
- but in addition it also provides all the methods of :class:`psutil.Process`
- class.
- For method names common to both classes such as
- :meth:`send_signal() <psutil.Process.send_signal()>`,
- :meth:`terminate() <psutil.Process.terminate()>` and
- :meth:`kill() <psutil.Process.kill()>`
- :class:`psutil.Process` implementation takes precedence.
- For a complete documentation refer to subprocess module documentation.
+ `subprocess.Popen`_, but in addition it also provides all the methods of
+ :class:`psutil.Process` class as a unified interface.
.. note::
@@ -1999,16 +1992,25 @@ Popen class
0
>>>
+ *timeout* parameter of `subprocess.Popen.wait`_ is backported for Python < 3.3.
:class:`psutil.Popen` objects are supported as context managers via the with
- statement: on exit, standard file descriptors are closed, and the process
- is waited for. This is supported on all Python versions.
+ statement (added to Python 3.2). On exit, standard file descriptors are
+ closed, and the process is waited for. This is supported on all Python
+ versions.
>>> import psutil, subprocess
>>> with psutil.Popen(["ifconfig"], stdout=subprocess.PIPE) as proc:
>>> log.write(proc.stdout.read())
- .. versionchanged:: 4.4.0 added context manager support
+ .. versionchanged:: 4.4.0 added context manager support.
+
+ .. versionchanged:: 5.7.1 inherit from `subprocess.Popen`_ instead of
+ :class:`psutil.Process`.
+
+ .. versionchanged:: 5.7.1 backporint `subprocess.Popen.wait`_ **timeout**
+ parameter on old Python versions.
+
Windows services
================
@@ -2882,6 +2884,7 @@ Timeline
.. _`SOCK_STREAM`: https://docs.python.org/3/library/socket.html#socket.SOCK_STREAM
.. _`socket.fromfd`: https://docs.python.org/3/library/socket.html#socket.fromfd
.. _`subprocess.Popen`: https://docs.python.org/3/library/subprocess.html#subprocess.Popen
+.. _`subprocess.Popen.wait`: https://docs.python.org/3/library/subprocess.html#subprocess.Popen.wait
.. _`temperatures.py`: https://github.com/giampaolo/psutil/blob/master/scripts/temperatures.py
.. _`TerminateProcess`: https://docs.microsoft.com/en-us/windows/desktop/api/processthreadsapi/nf-processthreadsapi-terminateprocess
.. _Tidelift security contact: https://tidelift.com/security