diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2020-05-02 15:19:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-03 00:19:53 +0200 |
commit | 42368e6a786415d932cb48d0fd006a0c302ab31b (patch) | |
tree | bb9ed83939f4742971791fa699282a82844ce66b /README.rst | |
parent | 6f2bdc4223789af13156915e930f2fff7d68d46a (diff) | |
download | psutil-42368e6a786415d932cb48d0fd006a0c302ab31b.tar.gz |
Process wait() improvements (#1747)
* `Process.wait()` on POSIX now returns an `enum` showing the negative which was used to terminate the process:
```python
>>> import psutil
>>> p = psutil.Process(9891)
>>> p.terminate()
>>> p.wait()
<Negsignal.SIGTERM: -15>
```
* the return value is cached so that the exit code can be retrieved on then next call, mimicking `subprocess.Popen.wait()`
* `Process` object provides more `status` and `exitcode` additional info on `str()` and `repr()`:
```
>>> proc
psutil.Process(pid=12739, name='python3', status='terminated', exitcode=<Negsigs.SIGTERM: -15>, started='15:08:20')
```
Extra:
* improved `wait()` doc
* reverted #1736: `psutil.Popen` uses original `subprocess.Popen.wait` method (safer)
Diffstat (limited to 'README.rst')
-rw-r--r-- | README.rst | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -438,7 +438,7 @@ Process management >>> p.terminate() >>> p.kill() >>> p.wait(timeout=3) - 0 + <Exitcode.EX_OK: 0> >>> >>> psutil.test() USER PID %CPU %MEM VSZ RSS TTY START TIME COMMAND |