mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
tools/jlink: Exit terminal on Ctrl+C
This commit is contained in:
parent
07131b4e4d
commit
79c095ef46
13
dist/tools/jlink/jlink.sh
vendored
13
dist/tools/jlink/jlink.sh
vendored
@ -236,15 +236,16 @@ do_term() {
|
||||
JLINK_PIDFILE=$(mktemp -t "jilnk_pid.XXXXXXXXXX")
|
||||
# will be called by trap
|
||||
cleanup() {
|
||||
JLINK_PID="$(cat ${JLINK_PIDFILE})"
|
||||
kill ${JLINK_PID}
|
||||
rm -r "${JLINK_PIDFILE}"
|
||||
if [ -f $JLINK_PIDFILE ]; then
|
||||
JLINK_PID="$(cat ${JLINK_PIDFILE})"
|
||||
kill ${JLINK_PID}
|
||||
rm -r "${JLINK_PIDFILE}"
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
# cleanup after script terminates
|
||||
trap "cleanup ${JLINK_PIDFILE}" EXIT
|
||||
# don't trapon Ctrl+C, because JLink keeps running
|
||||
trap '' INT
|
||||
trap "cleanup ${JLINK_PIDFILE}" EXIT INT
|
||||
|
||||
# start Jlink as RTT server
|
||||
sh -c "${JLINK} ${JLINK_SERIAL} \
|
||||
-ExitOnError 1 \
|
||||
|
Loading…
Reference in New Issue
Block a user