Skip to content
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

Process wait() improvements #1747

Merged
merged 19 commits into from
May 2, 2020
Merged

Process wait() improvements #1747

merged 19 commits into from
May 2, 2020

Conversation

giampaolo
Copy link
Owner

@giampaolo giampaolo commented May 2, 2020

  • Process.wait() on POSIX now returns an enum showing the negative which was used to terminate the process:
>>> 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:

@giampaolo giampaolo merged commit 42368e6 into master May 2, 2020
@giampaolo giampaolo deleted the wait-exit-code branch May 2, 2020 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant