[matter] improve waitpid() error handling

This commit is contained in:
Fabio Erculiani
2011-08-04 01:11:51 +02:00
parent bbe82b461d
commit 1e9fb24734

View File

@@ -523,7 +523,11 @@ class PackageBuilder(object):
sys.stderr.write(repr(exc) + "\n")
os._exit(1)
else:
rcpid, exit_st = os.waitpid(pid, os.P_WAIT)
try:
rcpid, exit_st = os.waitpid(pid, os.P_WAIT)
except Exception as exc:
os.kill(pid, signal.SIGTERM)
exit_st = 1
if exit_st != 0:
return exit_st
@@ -761,7 +765,11 @@ class PackageBuilder(object):
sys.stderr.write(repr(exc) + "\n")
os._exit(1)
else:
rcpid, rc = os.waitpid(pid, os.P_WAIT)
try:
rcpid, rc = os.waitpid(pid, os.P_WAIT)
except Exception as exc:
os.kill(pid, signal.SIGTERM)
rc = 1
if rc == 0:
return False
return True