summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2013-11-01 15:58:33 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-11-04 10:53:50 +0000
commit25f50e24c72aa5f253ff5d9186637adb15a20123 (patch)
treef9ac76572175cab57065103b142122fa28d1b3e7
parenta6b357a9af161f7dae598a9477dd84cc431362f8 (diff)
downloadpoky-25f50e24c72aa5f253ff5d9186637adb15a20123.tar.gz
bitbake: toaster: server shutdown on terminal exit
If the terminal where the server was started is closed, the bitbake server should shutdown. Currently the system is left in hanging state. This patch uses "trap" command to make sure the servers are closed on terminal exit. [YOCTO #5376] (Bitbake rev: 5f8b97010f7b465753b6ff6275d18426006ee14b) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xbitbake/bin/toaster29
1 files changed, 20 insertions, 9 deletions
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster
index 16de52b115..cc631f6f56 100755
--- a/bitbake/bin/toaster
+++ b/bitbake/bin/toaster
@@ -49,6 +49,19 @@ function webserverStartAll()
49 return $retval 49 return $retval
50} 50}
51 51
52# define the stop command
53function stop_system()
54{
55 if [ -f ${BUILDDIR}/.toasterui.pid ]; then
56 kill $(< ${BUILDDIR}/.toasterui.pid )
57 rm ${BUILDDIR}/.toasterui.pid
58 fi
59 BBSERVER=localhost:8200 bitbake -m
60 unset BBSERVER
61 webserverKillAll
62 # force stop any misbehaving bitbake server
63 lsof bitbake.lock | awk '{print $2}' | grep "[0-9]\+" | xargs -n1 -r kill
64}
52 65
53# We make sure we're running in the current shell and in a good environment 66# We make sure we're running in the current shell and in a good environment
54 67
@@ -116,6 +129,9 @@ and
116fi 129fi
117 130
118 131
132
133
134
119# Execute the commands 135# Execute the commands
120 136
121case $CMD in 137case $CMD in
@@ -127,17 +143,12 @@ case $CMD in
127 if [ $NOTOASTERUI == 0 ]; then # we start the TOASTERUI only if not inhibited 143 if [ $NOTOASTERUI == 0 ]; then # we start the TOASTERUI only if not inhibited
128 bitbake --observe-only -u toasterui >${BUILDDIR}/toaster_ui.log 2>&1 & echo $! >${BUILDDIR}/.toasterui.pid 144 bitbake --observe-only -u toasterui >${BUILDDIR}/toaster_ui.log 2>&1 & echo $! >${BUILDDIR}/.toasterui.pid
129 fi 145 fi
146 # stop system on terminal exit
147 trap stop_system SIGHUP
130 ;; 148 ;;
131 stop ) 149 stop )
132 if [ -f ${BUILDDIR}/.toasterui.pid ]; then 150 stop_system
133 kill $(< ${BUILDDIR}/.toasterui.pid ) 151 trap '' SIGHUP
134 rm ${BUILDDIR}/.toasterui.pid
135 fi
136 bitbake -m
137 unset BBSERVER
138 webserverKillAll
139 # force stop any misbehaving bitbake server
140 lsof bitbake.lock | awk '{print $2}' | grep "[0-9]\+" | xargs -n1 -r kill
141 ;; 152 ;;
142esac 153esac
143 154