mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-22 16:42:20 +03:00
finding pid and killing process abilities were extended
This commit is contained in:
parent
3b9c5fa097
commit
46047ac43b
1 changed files with 23 additions and 1 deletions
|
@ -91,6 +91,8 @@ class System:
|
|||
def pids():
|
||||
return psutil.pids()
|
||||
|
||||
|
||||
|
||||
@staticmethod
|
||||
def find_pid_by_name(p_name):
|
||||
for id in psutil.pids():
|
||||
|
@ -99,10 +101,29 @@ class System:
|
|||
return None
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def find_pids_by_name(p_name):
|
||||
arr = []
|
||||
|
||||
for pid in psutil.get_pid_list():
|
||||
if psutil.Process(pid).name==p_name:
|
||||
arr.append(pid)
|
||||
return arr
|
||||
|
||||
|
||||
@staticmethod
|
||||
def is_running(pid):
|
||||
return psutil.pid_exists(pid)
|
||||
|
||||
@staticmethod
|
||||
def kill_by_pid(pid):
|
||||
return psutil.Process(pid).kill()
|
||||
|
||||
@staticmethod
|
||||
def kill_by_pids(pids):
|
||||
for pid in pids:
|
||||
psutil.Process(pid).kill()
|
||||
|
||||
@staticmethod
|
||||
def find_name_by_pid(pid):
|
||||
return psutil.Process(pid).name()
|
||||
|
@ -134,6 +155,7 @@ class System:
|
|||
return psutil.Process(pid).create_time()
|
||||
|
||||
|
||||
|
||||
"""
|
||||
@staticmethod
|
||||
def cpu_times(pid):
|
||||
|
|
Loading…
Reference in a new issue