aboutsummaryrefslogtreecommitdiffstats
path: root/bitbake/bin
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2014-11-17 02:27:36 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-11-20 14:15:32 +0000
commitc09e56168ea5a9e4ff3e7f38d7da79e5d883021b (patch)
tree5c987833c57afea7bb138e858bf2c36c6b1967c1 /bitbake/bin
parent7d559fcca8ac552770e20d0831ed755a75f3a9fd (diff)
downloadopenembedded-core-contrib-c09e56168ea5a9e4ff3e7f38d7da79e5d883021b.tar.gz
bitbake: bitbake-worker: exit normally when SIGHUP
Fixed: 1) Run "bitbake recipe" in the terminal 2) Close the terminal while building 3) $ ps aux | grep bitbake-worker There will be many processes, and they will keep the resources (e.g., memory), and won't exit unless kill or kill -9. (Bitbake rev: 40d2ae0723de2bf5fee343faafb4afda40546839) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin')
-rwxr-xr-xbitbake/bin/bitbake-worker9
1 files changed, 8 insertions, 1 deletions
diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker
index dde2c9c8fc..371c99a677 100755
--- a/bitbake/bin/bitbake-worker
+++ b/bitbake/bin/bitbake-worker
@@ -147,6 +147,8 @@ def fork_off_task(cfg, data, workerdata, fn, task, taskname, appends, taskdepdat
pipein.close()
signal.signal(signal.SIGTERM, sigterm_handler)
+ # Let SIGHUP exit as SIGTERM
+ signal.signal(signal.SIGHUP, sigterm_handler)
# Save out the PID so that the event can include it the
# events
@@ -266,9 +268,14 @@ class BitbakeWorker(object):
self.build_pipes = {}
signal.signal(signal.SIGTERM, self.sigterm_exception)
+ # Let SIGHUP exit as SIGTERM
+ signal.signal(signal.SIGHUP, self.sigterm_exception)
def sigterm_exception(self, signum, stackframe):
- bb.warn("Worker recieved SIGTERM, shutting down...")
+ if signum == signal.SIGTERM:
+ bb.warn("Worker recieved SIGTERM, shutting down...")
+ elif signum == signal.SIGHUP:
+ bb.warn("Worker recieved SIGHUP, shutting down...")
self.handle_finishnow(None)
signal.signal(signal.SIGTERM, signal.SIG_DFL)
os.kill(os.getpid(), signal.SIGTERM)