[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
fi
done
opam_root="${OPAMROOT:-}"
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"
fi
}

Loading…
Cancel
Save