Frontend: starting the connection before linking
Dependencies
- [2]
6MGFBMONDebug and cleanup - [3]
UWQB743KFirst working shell (with ocaml code) - [4]
ODUDDQRYAdding the OCaml interface - [5]
RLH67CXJMake the "file" argument optional in `elpe build`
Change contents
- edit in elpe/bin/elpe_bin.ml at line 1
open Lwt.Syntax - replacement in elpe/bin/elpe_bin.ml at line 15
let run_shell (spec : Elpe.std_derivation) cmd =Lwt_main.run(let open Lwt.Syntax inlet port = 50051 inlet address = "127.0.0.1" inlet* c = connection address port inElpe.backend_conn := Some c;let* b = spec#setup inlet run_shell (spec : Elpe.derivation) cmd =let* b = spec#setup in - replacement in elpe/bin/elpe_bin.ml at line 18
let* bash = (Elpe.ubuntu "bash-static")#build inlet bash = List.hd bash.destdir inlet* bash = (Elpe.ubuntu "bash-static")#build inlet bash = List.hd bash.destdir in - replacement in elpe/bin/elpe_bin.ml at line 21
let f = Filename.temp_dir "elpe-" "" ^ "/setup" inUnix.mkfifo f 0o666;let f = Filename.temp_dir "elpe-" "" ^ "/setup" inUnix.mkfifo f 0o666; - replacement in elpe/bin/elpe_bin.ml at line 24
let pid =Unix.create_process(bash ^ "/usr/bin/bash-static")(match cmd with| None -> [| "bash"; "--init-file"; f; "-i" |]| Some cmd -> [| "bash"; "--init-file"; f; "-i"; "-c"; cmd |])Unix.stdin Unix.stdout Unix.stderrinlet pid =Unix.create_process(bash ^ "/usr/bin/bash-static")(match cmd with| None -> [| "bash"; "--init-file"; f; "-i" |]| Some cmd -> [| "bash"; "--init-file"; f; "-i"; "-c"; cmd |])Unix.stdin Unix.stdout Unix.stderrin - replacement in elpe/bin/elpe_bin.ml at line 33
let p = Unix.openfile f [ Unix.O_WRONLY ] 0o644 inlet _ = Unix.write_substring p b 0 (String.length b) inUnix.close p;let p = Unix.openfile f [ Unix.O_WRONLY ] 0o644 inlet _ = Unix.write_substring p b 0 (String.length b) inUnix.close p; - replacement in elpe/bin/elpe_bin.ml at line 37
match Unix.waitpid [] pid with| _, Unix.WEXITED e -> Lwt.return e| _ -> failwith "Unknown")match Unix.waitpid [] pid with| _, Unix.WEXITED e -> Lwt.return e| _ -> failwith "Unknown" - replacement in elpe/bin/elpe_bin.ml at line 42
Lwt_main.run(let open Lwt.Syntax inlet port = 50051 inlet address = "127.0.0.1" inlet* c = connection address port inElpe.backend_conn := Some c;let* b = spec#build inprint_endline (List.fold_left (fun _ x -> x) "" b.destdir);Lwt.return ())let* b = spec#build inprint_endline (List.fold_left (fun _ x -> x) "" b.destdir);Lwt.return () - edit in elpe/bin/elpe_bin.ml at line 71
let port = 50051 inlet address = "127.0.0.1" inlet* c = connection address port inElpe.backend_conn := Some c; - replacement in elpe/bin/elpe_bin.ml at line 83
Dynlink.loadfile objLwt.return (Dynlink.loadfile obj) - replacement in elpe/bin/elpe_bin.ml at line 92
compile files;match !Elpe.last_built_module with| None -> Unix._exit 0| Some last -> Unix._exit (run_shell last cmd))Lwt_main.run(let* _ = compile (if files = [] then [ "build.ml" ] else files) inmatch !Elpe.last_built_module with| None -> Unix._exit 0| Some last ->let* last = last inlet* shell = run_shell last cmd inUnix._exit shell)) - replacement in elpe/bin/elpe_bin.ml at line 106[3.75630]→[2.309:372](∅→∅),[3.135]→[3.75652:75814](∅→∅),[2.372]→[3.75652:75814](∅→∅),[3.75652]→[3.75652:75814](∅→∅)
compile (if files = [] then [ "build.ml" ] else files);let _ =match !Elpe.last_built_module with| None -> ()| Some last -> run_build (last :> Elpe.derivation)in())Lwt_main.run(let* _ = compile (if files = [] then [ "build.ml" ] else files) inmatch !Elpe.last_built_module with| None -> Lwt.return ()| Some last ->let* last = last inrun_build (last :> Elpe.derivation)))