run.sh: add trap
This commit is contained in:
parent
372d499f62
commit
7eda20f3cc
5
run.sh
5
run.sh
@ -3,6 +3,10 @@
|
||||
set -e
|
||||
#set -x
|
||||
|
||||
deactivate_venv() {
|
||||
[ -n "$VIRTUAL_ENV" ] && deactivate
|
||||
}
|
||||
|
||||
configdir=$HOME/.config/tgschedpub
|
||||
|
||||
DIR="$(dirname "$(realpath "$0")")"
|
||||
@ -13,6 +17,7 @@ install=0
|
||||
|
||||
if [ $install -eq 1 ]; then python3 -m venv .venv; fi
|
||||
. ./.venv/bin/activate
|
||||
trap deactivate_venv EXIT INT TERM
|
||||
if [ $install -eq 1 ]; then pip install -r requirements.txt; fi
|
||||
|
||||
[ -d "$configidr" ] || {
|
||||
|
Loading…
x
Reference in New Issue
Block a user