autotest: remove dependency on getppid()

makes pysim more windows friendly
This commit is contained in:
Andrew Tridgell 2013-03-26 08:20:40 +11:00
parent 57c498b570
commit 8b21cac5fd

View File

@ -202,8 +202,15 @@ def lock_file(fname):
return None return None
return f return f
def check_parent(parent_pid=os.getppid()): def check_parent(parent_pid=None):
'''check our parent process is still alive''' '''check our parent process is still alive'''
if parent_pid is None:
try:
parent_pid = os.getppid()
except Exception:
pass
if parent_pid is None:
return
try: try:
os.kill(parent_pid, 0) os.kill(parent_pid, 0)
except Exception: except Exception: