File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -167,3 +167,15 @@ let ctype_get_desc ty =
167167#else
168168 (Ctype. repr ty).Types. desc
169169#endif
170+
171+ exception Exit_with_status of int
172+
173+ let execute_phrase print_outcome ppf phr =
174+ #if OCAML_VERSION > = (4 , 12 , 0 )
175+ match Toploop. execute_phrase print_outcome ppf phr with
176+ | v -> v
177+ | exception Compenv. Exit_with_status status ->
178+ raise (Exit_with_status status)
179+ #else
180+ Toploop. execute_phrase print_outcome ppf phr
181+ #endif
Original file line number Diff line number Diff line change @@ -59,3 +59,8 @@ val ctype_is_equal :
5959
6060val ctype_expand_head_and_get_desc : Env .t -> Types .type_expr -> Types .type_desc
6161val ctype_get_desc : Types .type_expr -> Types .type_desc
62+
63+ exception Exit_with_status of int
64+
65+ val execute_phrase :
66+ bool -> Format .formatter -> Parsetree .toplevel_phrase -> bool
Original file line number Diff line number Diff line change @@ -305,7 +305,7 @@ module Rewrite = struct
305305 let preload verbose ppf =
306306 let require pkg =
307307 let p = top_directive_require pkg in
308- let _ = Toploop. execute_phrase verbose ppf p in
308+ let _ = execute_phrase verbose ppf p in
309309 ()
310310 in
311311 match active_rewriters () with
@@ -356,8 +356,8 @@ let toplevel_exec_phrase t ppf p =
356356 if ! Clflags. dump_parsetree then Printast. top_phrase ppf phrase;
357357 if ! Clflags. dump_source then Pprintast. top_phrase ppf phrase;
358358 Env. reset_cache_toplevel () ;
359- try Toploop. execute_phrase t.verbose ppf phrase
360- with Compenv. Exit_with_status code ->
359+ try execute_phrase t.verbose ppf phrase
360+ with Exit_with_status code ->
361361 Format. fprintf ppf " [%d]@." code;
362362 false )
363363
You can’t perform that action at this time.
0 commit comments