summaryrefslogtreecommitdiffstats
path: root/bitbake/bin/toaster
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 09:36:22 +0000
commit16067d529597d14542c574c9788f9aac344178f2 (patch)
treec4ddebb201a6cb760b402a178bc692d43a0f6aa7 /bitbake/bin/toaster
parentaf32d95f3beeb678fb59436445237efe53a36726 (diff)
downloadpoky-16067d529597d14542c574c9788f9aac344178f2.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>
Diffstat (limited to 'bitbake/bin/toaster')
-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