Revision b1ec912d mininet/clean.py

View differences:

mininet/clean.py
10 10
nothing irreplaceable!
11 11
"""
12 12

  
13
from subprocess import Popen, PIPE, check_output as co
13
from subprocess import ( Popen, PIPE, check_output as co,
14
                         CalledProcessError )
14 15
import time
15 16

  
16 17
from mininet.log import info
......
28 29
    # Make sure they are gone
29 30
    while True:
30 31
        try:
31
            pids = co( 'pgrep -f %s' % pattern )
32
        except:
32
            pids = co( [ 'pgrep', '-f', pattern ] )
33
        except CalledProcessError:
33 34
            pids = ''
34 35
        if pids:
35
            sh( 'pkill -f 9 mininet:' )
36
            sh( 'pkill -9 -f %s' % pattern )
36 37
            time.sleep( .5 )
37 38
        else:
38 39
            break

Also available in: Unified diff