[opam] do not crash when the switch does not exist

Summary: Fixes #1258.

Reviewed By: martintrojer

Differential Revision: D21548073

fbshipit-source-id: ddb994910
master
Jules Villard 5 years ago committed by Facebook GitHub Bot
parent ef7bc324e3
commit 418a1b586c

@ -58,8 +58,11 @@ opam_switch_create_if_needed () {
break break
fi fi
done done
opam_root="${OPAMROOT:-}"
if [ "$switch_exists" = "no" ]; then if [ "$switch_exists" = "no" ]; then
rm -rf "$OPAMROOT/$switch" if [ -n "$opam_root" ]; then
rm -rf "$opam_root/$switch" || true
fi
opam switch create "$switch" "$compiler" opam switch create "$switch" "$compiler"
fi fi
} }

Loading…
Cancel
Save