SHARE
TWEET

Untitled

a guest Nov 14th, 2017 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     def process_exists(self, procname):
  2.         ps = subprocess.Popen("ps -A", shell=True, stdout=subprocess.PIPE)
  3.         ps_pid = ps.pid
  4.         output = ps.stdout.read()
  5.         ps.stdout.close()
  6.         ps.wait()
  7.  
  8.         for line in output.split('\n'):
  9.             if line != "" and line != None:
  10.                 fields = line.split()
  11.                 pid = fields[0]
  12.                 pname = fields[3]
  13.  
  14.                 if (pname == procname):
  15.                     return True
  16.                 else:
  17.                     return True
  18.         return False
RAW Paste Data
Top