Use Env.t over string array in another place

This commit is contained in:
Rudi Grinberg 2018-03-15 18:18:15 +08:00
parent dea2ac77ca
commit bd457ea549
5 changed files with 8 additions and 2 deletions

View File

@ -49,6 +49,7 @@ let set_common c ~targets =
]
let restore_cwd_and_execve common prog argv env =
let env = Env.to_unix env in
let prog =
if Filename.is_relative prog then
Filename.concat common.root prog

View File

@ -433,7 +433,7 @@ let env_for_exec t =
(Config.local_install_man_dir ~context:t.name)
]
in
Env.to_unix (Env.extend t.env ~vars:(Env.Map.of_list_exn vars))
Env.extend t.env ~vars:(Env.Map.of_list_exn vars)
let compiler t (mode : Mode.t) =
match mode with

View File

@ -130,7 +130,7 @@ val opam_config_var : t -> string -> string option Fiber.t
val install_prefix : t -> Path.t Fiber.t
val install_ocaml_libdir : t -> Path.t option Fiber.t
val env_for_exec : t -> string array
val env_for_exec : t -> Env.t
(** Return the compiler needed for this compilation mode *)
val compiler : t -> Mode.t -> Path.t option

View File

@ -69,6 +69,9 @@ let add t ~var ~value =
let extend t ~vars =
make (Map.union t.vars vars ~f:(fun _ _ v -> Some v))
let extend_env x y =
extend x ~vars:y.vars
let sexp_of_t t =
let open Sexp.To_sexp in
(list (pair string string)) (Map.to_list t.vars)

View File

@ -17,6 +17,8 @@ val get : t -> Var.t -> string option
val extend : t -> vars:string Map.t -> t
val extend_env : t -> t -> t
val add : t -> var:Var.t -> value:string -> t
val diff : t -> t -> t