Skip to content

Commit

Permalink
update doc + change git hook location
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Mar 2, 2019
1 parent 784fac2 commit 7a9e796
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ git-tag-release: ## Git-tag a new release.
git push --follow-tags

install-git-hooks: ## Install GIT pre-commit hook.
ln -sf ../../.git-pre-commit .git/hooks/pre-commit
ln -sf ../../scripts/internal/.git-pre-commit .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit

# ===================================================================
Expand Down
18 changes: 10 additions & 8 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2313,7 +2313,7 @@ Constants
Unicode
=======

Starting from version 5.3.0 psutil fully supports unicode, see
Starting from version 5.3.0 psutil adds unicode support, see
`issue #1040 <https://github.com/giampaolo/psutil/issues/1040>`__.
The notes below apply to *any* API returning a string such as
:meth:`Process.exe` or :meth:`Process.cwd`, including non-filesystem related
Expand Down Expand Up @@ -2352,9 +2352,6 @@ and 3::
Recipes
=======

Follows a collection of utilities and examples which are common but not generic
enough to be part of the public API.

Find process by name
--------------------

Expand Down Expand Up @@ -2406,8 +2403,7 @@ Kill process tree
"on_terminate", if specified, is a callabck function which is
called as soon as a child terminates.
"""
if pid == os.getpid():
raise RuntimeError("I refuse to kill myself")
assert pid != os.getpid(), "won't kill myself"
parent = psutil.Process(pid)
children = parent.children(recursive=True)
if include_parent:
Expand Down Expand Up @@ -2437,13 +2433,19 @@ resources.
procs = psutil.Process().children()
# send SIGTERM
for p in procs:
p.terminate()
try:
p.terminate()
except psutil.NoSuchProcess:
pass
gone, alive = psutil.wait_procs(procs, timeout=timeout, callback=on_terminate)
if alive:
# send SIGKILL
for p in alive:
print("process {} survived SIGTERM; trying SIGKILL" % p)
p.kill()
try:
p.kill()
except psutil.NoSuchProcess:
pass
gone, alive = psutil.wait_procs(alive, timeout=timeout, callback=on_terminate)
if alive:
# give up
Expand Down
5 changes: 0 additions & 5 deletions psutil/DEVNOTES

This file was deleted.

3 changes: 0 additions & 3 deletions psutil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,9 +922,6 @@ def cpu_affinity(self, cpus=None):
(and set).
(Windows, Linux and BSD only).
"""
# Automatically remove duplicates both on get and
# set (for get it's not really necessary, it's
# just for extra safety).
if cpus is None:
return list(set(self._proc.cpu_affinity_get()))
else:
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/internal/winmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def test_memleaks():
def install_git_hooks():
"""Install GIT pre-commit hook."""
if os.path.isdir('.git'):
src = os.path.join(ROOT_DIR, ".git-pre-commit")
src = os.path.join(ROOT_DIR, "scripts", "internal", ".git-pre-commit")
dst = os.path.realpath(
os.path.join(ROOT_DIR, ".git", "hooks", "pre-commit"))
with open(src, "rt") as s:
Expand Down

0 comments on commit 7a9e796

Please sign in to comment.