Make Process.run take Env.t directly
This commit is contained in:
parent
4b191b2b03
commit
3193e4902d
|
@ -716,7 +716,7 @@ let exec_run_direct ~ectx ~dir ~env_extra ~stdout_to ~stderr_to prog args =
|
|||
invalid_prefix ("_build/install/" ^ target.name);
|
||||
end;
|
||||
let env = Env.extend ectx.env ~vars:env_extra in
|
||||
Process.run Strict ~dir:(Path.to_string dir) ~env:(Env.to_unix env)
|
||||
Process.run Strict ~dir:(Path.to_string dir) ~env
|
||||
~stdout_to ~stderr_to
|
||||
~purpose:ectx.purpose
|
||||
(Path.reach_for_running ~from:dir prog) args
|
||||
|
|
|
@ -110,8 +110,7 @@ let opam_config_var ~env ~cache var =
|
|||
match Bin.opam with
|
||||
| None -> Fiber.return None
|
||||
| Some fn ->
|
||||
Process.run_capture (Accept All) (Path.to_string fn)
|
||||
~env:(Env.to_unix env)
|
||||
Process.run_capture (Accept All) (Path.to_string fn) ~env
|
||||
["config"; "var"; var]
|
||||
>>| function
|
||||
| Ok s ->
|
||||
|
@ -146,7 +145,7 @@ let create ~(kind : Kind.t) ~path ~env_extra ~name ~merlin
|
|||
match Sys.getenv "OCAMLFIND_CONF" with
|
||||
| s -> Fiber.return (Path.absolute s)
|
||||
| exception Not_found ->
|
||||
Process.run_capture_line ~env:(Env.to_unix env) Strict
|
||||
Process.run_capture_line ~env Strict
|
||||
(Path.to_string fn) ["printconf"; "conf"]
|
||||
>>| Path.absolute)
|
||||
in
|
||||
|
@ -208,9 +207,7 @@ let create ~(kind : Kind.t) ~path ~env_extra ~name ~merlin
|
|||
| None -> args
|
||||
| Some s -> "-toolchain" :: s :: args
|
||||
in
|
||||
Process.run_capture_lines
|
||||
~env:(Env.to_unix env)
|
||||
Strict (Path.to_string fn) args
|
||||
Process.run_capture_lines ~env Strict (Path.to_string fn) args
|
||||
>>| List.map ~f:Path.absolute
|
||||
| None ->
|
||||
(* If there no ocamlfind in the PATH, check if we have opam
|
||||
|
@ -233,7 +230,7 @@ let create ~(kind : Kind.t) ~path ~env_extra ~name ~merlin
|
|||
Fiber.fork_and_join
|
||||
findlib_path
|
||||
(fun () ->
|
||||
Process.run_capture_lines ~env:(Env.to_unix env) Strict
|
||||
Process.run_capture_lines ~env Strict
|
||||
(Path.to_string ocamlc) ["-config"]
|
||||
>>| fun lines ->
|
||||
let open Result.O in
|
||||
|
@ -409,7 +406,7 @@ let install_ocaml_libdir t =
|
|||
(* If ocamlfind is present, it has precedence over everything else. *)
|
||||
match which t "ocamlfind" with
|
||||
| Some fn ->
|
||||
(Process.run_capture_line ~env:(Env.to_unix t.env) Strict
|
||||
(Process.run_capture_line ~env:t.env Strict
|
||||
(Path.to_string fn) ["printconf"; "destdir"]
|
||||
>>| fun s ->
|
||||
Some (Path.absolute s))
|
||||
|
|
|
@ -149,7 +149,7 @@ end
|
|||
]}
|
||||
*)
|
||||
Process.run Strict ~dir:(Path.to_string dir)
|
||||
~env:(Env.to_unix context.env)
|
||||
~env:context.env
|
||||
(Path.to_string context.ocaml)
|
||||
args
|
||||
>>= fun () ->
|
||||
|
|
|
@ -243,7 +243,7 @@ let run_internal ?dir ?(stdout_to=Terminal) ?(stderr_to=Terminal) ?env ~purpose
|
|||
Unix.create_process prog argv
|
||||
Unix.stdin stdout stderr
|
||||
| Some env ->
|
||||
Unix.create_process_env prog argv env
|
||||
Unix.create_process_env prog argv (Env.to_unix env)
|
||||
Unix.stdin stdout stderr
|
||||
in
|
||||
let pid =
|
||||
|
|
|
@ -41,7 +41,7 @@ val run
|
|||
: ?dir:string
|
||||
-> ?stdout_to:std_output_to
|
||||
-> ?stderr_to:std_output_to
|
||||
-> ?env:string array
|
||||
-> ?env:Env.t
|
||||
-> ?purpose:purpose
|
||||
-> (unit, 'a) failure_mode
|
||||
-> string
|
||||
|
@ -51,7 +51,7 @@ val run
|
|||
(** Run a command and capture its output *)
|
||||
val run_capture
|
||||
: ?dir:string
|
||||
-> ?env:string array
|
||||
-> ?env:Env.t
|
||||
-> ?purpose:purpose
|
||||
-> (string, 'a) failure_mode
|
||||
-> string
|
||||
|
@ -59,7 +59,7 @@ val run_capture
|
|||
-> 'a Fiber.t
|
||||
val run_capture_line
|
||||
: ?dir:string
|
||||
-> ?env:string array
|
||||
-> ?env:Env.t
|
||||
-> ?purpose:purpose
|
||||
-> (string, 'a) failure_mode
|
||||
-> string
|
||||
|
@ -67,7 +67,7 @@ val run_capture_line
|
|||
-> 'a Fiber.t
|
||||
val run_capture_lines
|
||||
: ?dir:string
|
||||
-> ?env:string array
|
||||
-> ?env:Env.t
|
||||
-> ?purpose:purpose
|
||||
-> (string list, 'a) failure_mode
|
||||
-> string
|
||||
|
|
Loading…
Reference in New Issue