run-in-simulavr.sh: terminate simulation if stop recieved.

Note by Traumflug: this

  while read -r LINE; do
    some commands
  done << (some other command)

didn't work here (bash 4.3.11 on Ubuntu 14.04), so I had to swap
the sequence of these two commands for using a pipe. Anyways,
excellent idea, shortens some simulator runs drastically!
This commit is contained in:
Erik Jonsson 2014-08-05 19:16:49 +02:00 committed by Markus Hitter
parent fa0e0d37e7
commit 0723b53c44
1 changed files with 10 additions and 3 deletions

View File

@ -84,11 +84,18 @@ for GCODE_FILE in $*; do
# We assume here queue and rx buffer are large enough to read
# the file in one chunk. If not, raise MOVEBUFFER_SIZE in config.h.
set -x
"${SIMULAVR}" -c vcd:${TRACEIN_FILE}:"${VCD_FILE}" \
-f ../build/teacup.elf \
-m 60000000000 -v < "${GCODE_FILE}"
set +x
-m 60000000000 -v < "${GCODE_FILE}" | \
while read -r LINE; do
echo "${LINE}"
case "${LINE}" in
stop)
echo "Got \"stop\", killing ${SIMULAVR}."
kill -INT $(pidof -x "${SIMULAVR}")
;;
esac
done
# Make plottable files from VCD files.