Commit ac10028e authored by Maxime Perrotin's avatar Maxime Perrotin

Add trap handling to scripts using progress bar

parent 1a0e9106
......@@ -7,13 +7,21 @@ mkfifo $myfifo
tail -f $myfifo | taste-progress-dialog.py &
function quit {
echo '100 Done' > $myfifo
echo '100 Completed' > $myfifo
rm $myfifo
tailps=$(pstree -p $$ | grep tail | python -c "import sys, re; print re.search(r'tail\((.*)\)', [x for x in sys.stdin][0]).group(1)")
kill $tailps || xterm -e "echo Internal Error, unable to kill subprocess. Open a terminal and type 'pkill tail' to (hopefully) recover"
tailps=$(pstree -p $$ | grep tail | python -c "try:
import sys, re; print re.search(r'tail\((.*)\)', [x for x in sys.stdin][0]).group(1)
except: pass")
if [ ! -z $tailps ]
then
kill $tailps || xterm -e "echo Internal Error in taste-update-data-view"
fi
exit $1
}
# Install a trap handler to make sure Ctrl-C leads to calling the quit function (trap 2 = SINGINT)
trap 2 quit 1
# Logging with colors (only in a terminal)
if [ -t 1 ] ; then
COLORON="\e[1m\e[32m"
......@@ -37,7 +45,7 @@ then
if [[ -f InterfaceView.aadl && -f DeploymentView.aadl && -f DataView.aadl ]]
then
echo -e "${INFO} Using InterfaceView.aadl, DeploymentView.aadl, DataView.aadl (defaults)"
INTERFACEVIEW=InterfaceView.aadl
INTERFACEVIEW=InterfaceView.aadl
DEPLOYMENTVIEW=DeploymentView.aadl
DATAVIEW=DataView.aadl
else
......
......@@ -9,13 +9,21 @@ mkfifo $myfifo
tail -f $myfifo | taste-progress-dialog.py &
function quit {
echo '100 Done' > $myfifo
echo '100 Completed' > $myfifo
rm $myfifo
tailps=$(pstree -p $$ | grep tail | python -c "import sys, re; print re.search(r'tail\((.*)\)', [x for x in sys.stdin][0]).group(1)")
kill $tailps || xterm -e "echo Internal Error, unable to kill subprocess. Open a terminal and type 'pkill tail' to (hopefully) recover"
tailps=$(pstree -p $$ | grep tail | python -c "try:
import sys, re; print re.search(r'tail\((.*)\)', [x for x in sys.stdin][0]).group(1)
except: pass")
if [ ! -z $tailps ]
then
kill $tailps || xterm -e "echo Internal Error in taste-update-data-view"
fi
exit $1
}
# Install a trap handler to make sure Ctrl-C leads to calling the quit function (trap 2 = SINGINT)
trap 2 quit 1
# Logging with colors (only in a terminal)
if [ -t 1 ] ; then
COLORON="\e[1m\e[32m"
......
......@@ -10,11 +10,19 @@ tail -f $myfifo | taste-progress-dialog.py &
function quit {
echo '100 Completed' > $myfifo
rm $myfifo
tailps=$(pstree -p $$ | grep tail | python -c "import sys, re; print re.search(r'tail\((.*)\)', [x for x in sys.stdin][0]).group(1)")
kill $tailps || xterm -e "echo Internal Error, unable to kill subprocess. Open a terminal and type 'pkill tail' to (hopefully) recover"
tailps=$(pstree -p $$ | grep tail | python -c "try:
import sys, re; print re.search(r'tail\((.*)\)', [x for x in sys.stdin][0]).group(1)
except: pass")
if [ ! -z $tailps ]
then
kill $tailps || xterm -e "echo Internal Error in taste-update-data-view"
fi
exit $1
}
# Install a trap handler to make sure Ctrl-C leads to calling the quit function (trap 2 = SINGINT)
trap 2 quit 1
if [ -t 1 ] ; then
COLORON="\e[1m\e[32m"
REDCOLORON="\e[1m\e[31m"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment