From 9dff466d12002c40e08d76eb7c38eba073f9ef58 Mon Sep 17 00:00:00 2001 From: Nathan Rebours Date: Wed, 17 Jul 2019 17:23:55 +0200 Subject: [PATCH] Set compiler's error-style and color through env vars in standalone mode Signed-off-by: Nathan Rebours --- src/driver.ml | 1 + src/gen-compiler_specifics | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/driver.ml b/src/driver.ml index 2916f16f0..423d27831 100644 --- a/src/driver.ml +++ b/src/driver.ml @@ -1257,6 +1257,7 @@ let standalone_run_as_ppx_rewriter () = ;; let standalone () = + Compiler_specifics.read_clflags_from_env (); try if Array.length Caml.Sys.argv >= 2 && match Caml.Sys.argv.(1) with diff --git a/src/gen-compiler_specifics b/src/gen-compiler_specifics index e28fd3fc5..56fd839ae 100644 --- a/src/gen-compiler_specifics +++ b/src/gen-compiler_specifics @@ -7,8 +7,11 @@ let () = let oc = open_out_bin Sys.argv.(2) in let pr fmt = fprintf oc (fmt ^^ "\n") in pr "module O = Ocaml_common"; - if ver < (4, 08) then - pr "let get_load_path () = !Ocaml_common.Config.load_path" - else + if ver < (4, 08) then ( + pr "let get_load_path () = !Ocaml_common.Config.load_path"; + pr "let read_clflags_from_env () = ()" + ) else ( pr "let get_load_path () = Ocaml_common.Load_path.get_paths ()"; + pr "let read_clflags_from_env () = Ocaml_common.Compmisc.read_clflags_from_env ()" + ); close_out oc