seanmcl avatar seanmcl committed fa944a7

Dimitri's patch for an env variable problem.

Comments (0)

Files changed (1)

   val set : Id.t -> var -> bool -> unit deferred
   val get : Id.t -> var -> bool deferred
   val set_emacs_env : Writer.t -> Id.t -> unit deferred
+  val setenv_all : Id.t -> unit deferred
 end = struct
   type var =
     X_LIBRARY_INLINING
 
   let get = Sys.getenv
 
-  let set ~key ~data = Unix.putenv ~key ~data
+  let setenv ~key ~data = Unix.putenv ~key ~data
 
   let get_exn key = match get key with
     | None -> failwithf "No env: %s" key ()
 
   let assure_set ~default ~key =
     match get key with
-    | None -> set ~key ~data:default
+    | None -> setenv ~key ~data:default
     | Some _ -> ()
 
   let () = begin
   let set id x b =
     env id >>= fun t ->
     var_to_set x t b;
+    setenv ~key:(var_to_string x) ~data:(string_of_bool b);
     save id t
 
+  let setenv_all id =
+    env id >>| fun t -> (
+      setenv ~key:(var_to_string X_LIBRARY_INLINING) ~data:(string_of_bool t.x_library_inlining);
+      setenv ~key:(var_to_string LINK_EXECUTABLES) ~data:(string_of_bool t.link_executables);
+      setenv ~key:(var_to_string VERSION_UTIL_SUPPORT) ~data:(string_of_bool t.version_util_support);
+      setenv ~key:(var_to_string LIMIT_SUBDIRS_FOR_SPEED) ~data:(string_of_bool t.limit_subdirs_for_speed);
+    )
+
   let set_emacs_env writer id =
     env id >>= fun t ->
     To_emacs.send writer " \
       t.link_executables
       t.version_util_support
       t.limit_subdirs_for_speed
+
 end
 
 (* -------------------------------------------------------------------------- *)
     | Q.Create create ->
       let id = create.C.id in
       let ids = Id.to_string id in
-      begin Models.create create >>| function
+      begin
+        Env.setenv_all id >>= fun () ->
+        Models.create create >>| function
       | Ok () -> Server.logf "Model created: %s" ids
       | Error `Already_exists -> model_exists id
       end
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.