Skip to content

Commit

Permalink
better/correctly parse ps
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-mangin committed Jul 17, 2019
1 parent 0c1440f commit a110d10
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions qa/sbin/bgp
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,17 @@ class BGPHandler(asyncore.dispatcher_with_send):

processes = []

for line in os.popen("/bin/ps"):
if 'python' not in line and 'pypy' not in line:
for line in os.popen("/bin/ps x"):
low = line.strip().lower()
if not low:
continue
if 'python' not in low and 'pypy' not in low:
continue

line = line.strip()
cmdline = line.strip().split()[4:]
pid = line.strip().split()[0]
cmdline = line.split("/",1)[1].split()

if not cmdline[1].endswith('/bgp.py'):
if len(cmdline) > 1 and not cmdline[1].endswith('/bgp.py'):
continue

if conf_name not in cmdline[-1]:
Expand Down

0 comments on commit a110d10

Please sign in to comment.