Skip to content

Commit 0274cd6

Browse files
committed
Clean up the switch if it is a fresh one
1 parent dbf5b16 commit 0274cd6

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

rsc/extra/generate_lock_file.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
3-
export LOCKED_SWITCH="alt-ergo-locked"
3+
export LOCKED_SWITCH="${LOCKED_SWITCH:=alt-ergo-locked}"
44
export OPAMYES=true
55
export OPAMSWITCH="$LOCKED_SWITCH"
66

7+
function cleanup() {
8+
opam switch remove "$LOCKED_SWITCH"
9+
}
10+
711
function check_switch_available() {
812
opam list >/dev/null 2>&1
913
}
@@ -16,6 +20,7 @@ EOF
1620
exit 1
1721
fi
1822

23+
trap cleanup EXIT
1924
opam switch create "$LOCKED_SWITCH" 5.4.1 --no-switch
2025

2126
opam install --deps-only --with-test --assume-depexts \

0 commit comments

Comments
 (0)