Commit 7f994bb7 authored by Guillaume Tucker's avatar Guillaume Tucker

run-servod: fix exception handling in cleanup function

Fix do_cleanup() to not abort if it fails to delete a directory or
stop a service process, but print a warning instead.
Signed-off-by: Guillaume Tucker's avatarGuillaume Tucker <guillaume.tucker@collabora.com>
parent 2da4934a
......@@ -44,12 +44,17 @@ CHILD_PID = 0
def do_cleanup(status):
shutil.rmtree(DEV_DIR, ignore_errors=True)
try:
if DEV_DIR:
shutil.rmtree(DEV_DIR, ignore_errors=True)
except:
print("Warning: failed to remove {}".format(DEV_DIR))
try:
os.kill(CHILD_PID, signal.SIGTERM)
if CHILD_PID:
os.kill(CHILD_PID, signal.SIGTERM)
except:
pass
print("Warning: failed to stop service with pid {}".format(CHILD_PID))
sys.exit(status)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment