diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-31 11:30:56 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-31 15:13:53 +0100 |
commit | 8625f83e383d3d30c1cb44d6293cc302728692cd (patch) | |
tree | acc48238978e429ae747781a4f6326681d08f9bf /bitbake | |
parent | 3010e4e7cf120f68afef4081bb1aa1733800589e (diff) | |
download | poky-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.py | 11 |
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" | |||
30 | import os # Miscellaneous OS interfaces. | 30 | import os # Miscellaneous OS interfaces. |
31 | import sys # System-specific parameters and functions. | 31 | import sys # System-specific parameters and functions. |
32 | import io | 32 | import io |
33 | import 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) | ||