Skip to content

Commit 75f2fc7

Browse files
authored
Merge pull request #813 from tleedjarv/fix-roots-assert
Remove an overly aggressive assertion
2 parents 992f15b + 6ef0186 commit 75f2fc7

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Diff for: src/globals.ml

+9-6
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,17 @@ let setRawRoots l = Prefs.set rawroots (Safelist.rev l)
4545

4646
let rawRoots () = Safelist.rev (Prefs.read rawroots)
4747

48+
let wrongNumRootsExn roots =
49+
Util.Fatal (Printf.sprintf "Wrong number of roots: \
50+
2 expected, but %d provided (%s)\n(Maybe you specified \
51+
roots both on the command line and in the profile?)"
52+
(Safelist.length roots)
53+
(String.concat ", " roots))
54+
4855
let rawRootPair () =
4956
match rawRoots () with
5057
[r1; r2] -> (r1, r2)
51-
| _ -> assert false
58+
| roots -> raise (wrongNumRootsExn roots)
5259

5360
let theroots = ref []
5461

@@ -58,11 +65,7 @@ open Lwt
5865
let installRoots termInteract =
5966
let () = uninstallRoots () in (* Clear out potential old roots *)
6067
let roots = rawRoots () in
61-
if Safelist.length roots <> 2 then
62-
raise (Util.Fatal (Printf.sprintf
63-
"Wrong number of roots: 2 expected, but %d provided (%s)\n(Maybe you specified roots both on the command line and in the profile?)"
64-
(Safelist.length roots)
65-
(String.concat ", " roots) ));
68+
if Safelist.length roots <> 2 then raise (wrongNumRootsExn roots);
6669
Safelist.fold_right
6770
(fun r cont ->
6871
Remote.canonizeRoot r (Clroot.parseRoot r) termInteract

0 commit comments

Comments
 (0)