diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2019-03-02 21:10:40 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2019-03-02 21:10:40 +0100 |
commit | 7a9e7969f172c80507416a0fb1df98bf72e71139 (patch) | |
tree | 874f56ff747b1138311fe7ce60e1ec80e1c88327 | |
parent | 784fac235b6305065eda1ff47a5df86c16eb866c (diff) | |
download | psutil-7a9e7969f172c80507416a0fb1df98bf72e71139.tar.gz |
update doc + change git hook location
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | docs/index.rst | 18 | ||||
-rw-r--r-- | psutil/DEVNOTES | 5 | ||||
-rw-r--r-- | psutil/__init__.py | 3 | ||||
-rwxr-xr-x | scripts/internal/.git-pre-commit (renamed from .git-pre-commit) | 0 | ||||
-rwxr-xr-x | scripts/internal/winmake.py | 2 |
6 files changed, 12 insertions, 18 deletions
@@ -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 # =================================================================== diff --git a/docs/index.rst b/docs/index.rst index 73a81cdb..23a72543 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -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 @@ -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 -------------------- @@ -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: @@ -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 diff --git a/psutil/DEVNOTES b/psutil/DEVNOTES deleted file mode 100644 index 4fd15ea3..00000000 --- a/psutil/DEVNOTES +++ /dev/null @@ -1,5 +0,0 @@ -API REFERENCES -============== - -- psutil.sensors_battery: - https://github.com/Kentzo/Power/ diff --git a/psutil/__init__.py b/psutil/__init__.py index d8ec701c..449a27ca 100644 --- a/psutil/__init__.py +++ b/psutil/__init__.py @@ -922,9 +922,6 @@ class Process(object): (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: diff --git a/.git-pre-commit b/scripts/internal/.git-pre-commit index c3c605e0..c3c605e0 100755 --- a/.git-pre-commit +++ b/scripts/internal/.git-pre-commit diff --git a/scripts/internal/winmake.py b/scripts/internal/winmake.py index c35853c5..cbdeebdc 100755 --- a/scripts/internal/winmake.py +++ b/scripts/internal/winmake.py @@ -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: |