mirror of
https://github.com/edu4rdshl/simpleaur.git
synced 2026-07-17 23:24:46 +00:00
Added support to catch user interrupt
This commit is contained in:
parent
16eb18ee3f
commit
e675d5d1ea
1 changed files with 8 additions and 1 deletions
|
|
@ -4,6 +4,14 @@ basebuilddir="$HOME/.simpleaur/Build"
|
|||
pacmanexist=$(which pacman 2> /dev/null)
|
||||
lockfile="$basebuilddir/simpleaur.lock"
|
||||
|
||||
ctrl_c() {
|
||||
printf "\n\n\e[1;31m%-6s\e[m%s\n" "Keyboard Interrupt detected, removing lock file and leaving..."
|
||||
rm "$lockfile"
|
||||
exit
|
||||
}
|
||||
|
||||
trap ctrl_c SIGINT
|
||||
|
||||
#Prevent two instances running at same time
|
||||
if [ -f "$lockfile" ]; then
|
||||
printf "\n\e[1;31m%-6s\e[m%s\n" "simpleaur is running, leaving."
|
||||
|
|
@ -86,5 +94,4 @@ for ipackage in "$@"; do
|
|||
rm -rf "$basebuilddir/$ipackage"
|
||||
fi
|
||||
done
|
||||
rm "$lockfile"
|
||||
exit
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue