Skip to content

Instantly share code, notes, and snippets.

@VintageAppMaker
Last active March 4, 2018 02:44
Show Gist options
  • Save VintageAppMaker/244705b97eee3a763bdb4ca9a89ccc48 to your computer and use it in GitHub Desktop.
Save VintageAppMaker/244705b97eee3a763bdb4ca9a89ccc48 to your computer and use it in GitHub Desktop.
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