From 74439b049e34d33de5958ab15b8edf15c13dd58c Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Wed, 13 May 2020 21:09:25 +0200 Subject: [PATCH] fix cleanup procdure, thanks to Till --- iocsh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/iocsh b/iocsh index 13514b0..7528eb6 100755 --- a/iocsh +++ b/iocsh @@ -363,7 +363,13 @@ done startup=/tmp/iocsh.startup.$$ # clean up and kill the softIoc when killed by any signal -trap "kill -s SIGTERM 0; (stty sane && echo) 2>/dev/null; rm -f $startup; " EXIT +cleanup() { + trap EXIT + rm -f $startup + stty sane 2> /dev/null + echo +} +trap "kill -s SIGTERM 0; cleanup" EXIT { echo "# date=\"$(date)\"" @@ -464,3 +470,4 @@ echo $EXE $ARGS $startup #enable core dumps ulimit -c unlimited eval "$LOADER $LOADERARGS $EXE" $ARGS "$startup" 2>&1 +cleanup