Esempio n. 1
0
def pids_from_program(program):
    ''' Get list of pids for program.

        Returns empty list if none
    '''

    try:
        if IS_PY2:
            pid_strings = sh.pidof(program).stdout.strip().split()
        else:
            pid_strings = sh.pidof(program).stdout.decode().strip().split()
    except sh.ErrorReturnCode_1:
        pids = []
    else:
        pids = [int(pid) for pid in pid_strings]

    return pids
Esempio n. 2
0
    def wait_for_network_manager_to_start(self):
        while True:
            try:
                if pidof('NetworkManager'):
                    return
            except Exception:
                pass

            time.sleep(1)
Esempio n. 3
0
    def wait_for_network_manager_to_start(self):
        while True:
            try:
                if pidof('NetworkManager'):
                    return
            except Exception:
                pass

            time.sleep(1)
Esempio n. 4
0
 def start_if_required():
   try:
     sh.pidof(proc_name)
   except sh.ErrorReturnCode:
     run_proc()
Esempio n. 5
0
 def start_if_required():
     try:
         sh.pidof(proc_name)
     except sh.ErrorReturnCode:
         run_proc()