This is an automated email from the ASF dual-hosted git repository.

duke8253 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 6abea90  replace psutil.pid() with psutil.process_iter() for safer 
execution (#7515)
6abea90 is described below

commit 6abea9063bfb0fa0b2d398bcf41d341f2e09f694
Author: Fei Deng <duke8...@gmail.com>
AuthorDate: Wed Feb 10 21:14:31 2021 -0600

    replace psutil.pid() with psutil.process_iter() for safer execution (#7515)
---
 tests/gold_tests/thread_config/check_threads.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/gold_tests/thread_config/check_threads.py 
b/tests/gold_tests/thread_config/check_threads.py
index 975e95f..7ebfb80 100755
--- a/tests/gold_tests/thread_config/check_threads.py
+++ b/tests/gold_tests/thread_config/check_threads.py
@@ -23,12 +23,11 @@ import sys
 
 def count_threads(ts_path, etnet_threads, accept_threads, task_threads, 
aio_threads):
 
-    for pid in psutil.pids():
+    for p in psutil.process_iter(['name', 'cwd', 'threads']):
 
         # Find the pid corresponding to the ats process we started in autest.
         # It needs to match the process name and the binary path.
         # If autest can expose the pid of the process this is not needed 
anymore.
-        p = psutil.Process(pid)
         if p.name() == '[TS_MAIN]' and p.cwd() == ts_path:
 
             etnet_check = set()

Reply via email to