Last active
March 4, 2018 02:44
-
-
Save VintageAppMaker/244705b97eee3a763bdb4ca9a89ccc48 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from uilib import * | |
import subprocess | |
def ParseProcInfo(s, sKeyword): | |
sline=s.split() | |
num = -1 | |
num = s.find(sKeyword) | |
if num == -1: return | |
AddProcInfo (sline[0] + ":\t" + sline[3], int(sline[0])) | |
def SearchFunc(sKeyword): | |
rst = subprocess.Popen(['ps', '-A'], stdout=subprocess.PIPE).communicate()[0] | |
proc_list = rst.split('\n') | |
for indx in proc_list: | |
num = -1 | |
num = indx.find("PID") | |
if num == 2: continue | |
if len(indx) > 0: ParseProcInfo(indx, sKeyword) | |
return | |
def DeleteFunc(pid): | |
subprocess.Popen(['kill', str(pid)], stdout=subprocess.PIPE).communicate()[0] | |
#AddProcInfo (str(pid), pid) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment