Make sure the action working directory exist
This commit is contained in:
parent
2f4ec1c281
commit
31922a590f
|
@ -3,6 +3,8 @@
|
|||
- Added =${lib-available:<library-name>}= which expands to =true= or
|
||||
=false= with the same semantic as literals in =(select ...)= stanzas
|
||||
|
||||
- Fix: make sure the action working directory exist before running it
|
||||
|
||||
* 1.0+beta7 (12/04/2017)
|
||||
|
||||
- Make the output quieter by default and add a =--verbose= argument
|
||||
|
|
|
@ -294,7 +294,16 @@ let () =
|
|||
pending_targets := Pset.empty;
|
||||
Pset.iter fns ~f:Path.unlink_no_err)
|
||||
|
||||
let make_local_dirs t paths ~map_path =
|
||||
let make_local_dir t path =
|
||||
match Path.kind path with
|
||||
| Local path ->
|
||||
if not (Path.Local.Set.mem path t.local_mkdirs) then begin
|
||||
Path.Local.mkdir_p path;
|
||||
t.local_mkdirs <- Path.Local.Set.add path t.local_mkdirs
|
||||
end
|
||||
| _ -> ()
|
||||
|
||||
let make_local_parent_dirs t paths ~map_path =
|
||||
Pset.iter paths ~f:(fun path ->
|
||||
match Path.kind (map_path path) with
|
||||
| Local path when not (Path.Local.is_root path) ->
|
||||
|
@ -336,7 +345,7 @@ let compile_rule t ~all_targets_by_dir ?(allow_override=false) pre_rule =
|
|||
end;
|
||||
|
||||
let exec = Exec_status.Not_started (fun ~targeting ->
|
||||
make_local_dirs t targets ~map_path:(fun x -> x);
|
||||
make_local_parent_dirs t targets ~map_path:(fun x -> x);
|
||||
wait_for_deps t deps ~targeting
|
||||
>>= fun () ->
|
||||
let action, dyn_deps = Build_exec.exec t build () in
|
||||
|
@ -410,8 +419,8 @@ let compile_rule t ~all_targets_by_dir ?(allow_override=false) pre_rule =
|
|||
else
|
||||
path
|
||||
in
|
||||
make_local_dirs t all_deps ~map_path:sandboxed;
|
||||
make_local_dirs t targets ~map_path:sandboxed;
|
||||
make_local_parent_dirs t all_deps ~map_path:sandboxed;
|
||||
make_local_parent_dirs t targets ~map_path:sandboxed;
|
||||
Action.sandbox action
|
||||
~sandboxed
|
||||
~deps:all_deps_as_list
|
||||
|
@ -419,6 +428,7 @@ let compile_rule t ~all_targets_by_dir ?(allow_override=false) pre_rule =
|
|||
| None ->
|
||||
action
|
||||
in
|
||||
make_local_dir t action.dir;
|
||||
Action.exec ~targets action >>| fun () ->
|
||||
Option.iter sandbox_dir ~f:Path.rm_rf;
|
||||
(* All went well, these targets are no longer pending *)
|
||||
|
|
Loading…
Reference in New Issue