summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-07-31 11:30:56 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-07-31 15:13:53 +0100
commit8625f83e383d3d30c1cb44d6293cc302728692cd (patch)
treeacc48238978e429ae747781a4f6326681d08f9bf /bitbake
parent3010e4e7cf120f68afef4081bb1aa1733800589e (diff)
downloadpoky-8625f83e383d3d30c1cb44d6293cc302728692cd.tar.gz
bitbake: daemonize: Ensure child process exits safely
When we create the child, if an exception occurred it was transfering back into the parent context. We don't want to do that us use a try/finally to ensure we exit. We need to ensure a traceback is printed and any queued UI messages which may not have made it to the client UI at this point. (Bitbake rev: dec1d2c26f6cb3ffeb44beaab0129cd531a6d08b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/daemonize.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/bitbake/lib/bb/daemonize.py b/bitbake/lib/bb/daemonize.py
index 8380828a17..a4664ad76b 100644
--- a/bitbake/lib/bb/daemonize.py
+++ b/bitbake/lib/bb/daemonize.py
@@ -30,6 +30,7 @@ __version__ = "0.2"
30import os # Miscellaneous OS interfaces. 30import os # Miscellaneous OS interfaces.
31import sys # System-specific parameters and functions. 31import sys # System-specific parameters and functions.
32import io 32import io
33import traceback
33 34
34# Default daemon parameters. 35# Default daemon parameters.
35# File mode creation mask of the daemon. 36# File mode creation mask of the daemon.
@@ -192,6 +193,10 @@ def createDaemon(function, logfile):
192 sys.stdout = open(logfile, 'a+') 193 sys.stdout = open(logfile, 'a+')
193 sys.stderr = sys.stdout 194 sys.stderr = sys.stdout
194 195
195 function() 196 try:
196 197 function()
197 os._exit(0) 198 except Exception as e:
199 traceback.print_exc()
200 bb.event.print_ui_queue()
201 finally:
202 os._exit(0)