diff --git a/Mailnag/common/subproc.py b/Mailnag/common/subproc.py index 6480bbf..8bddee0 100644 --- a/Mailnag/common/subproc.py +++ b/Mailnag/common/subproc.py @@ -45,15 +45,19 @@ def start_subprocess(args, shell = False, callback = None): with _lock: del _procs[t] p = None + pid = -1 try: p = subprocess.Popen(args, shell = shell) except: logging.exception('Caught an exception.') if p != None: + pid = p.pid t = threading.Thread(target = thread) with _lock: _procs[t] = p t.start() + + return pid def terminate_subprocesses():