Commit 0d3a5781 authored by Stephane Glondu's avatar Stephane Glondu

Move call to "rm -rf" to its own function

parent 03e02c39
......@@ -294,6 +294,11 @@ let write_file ?uuid x lines =
)
) >> Lwt_unix.rename fname_new fname
let rmdir dir =
let command = "rm", [| "rm"; "-rf"; dir |] in
let%lwt _ = Lwt_process.exec command in
return_unit
let compile_auth_config {auth_system; auth_instance; auth_config} =
auth_instance, (auth_system, List.map snd auth_config)
......
......@@ -111,6 +111,7 @@ val extract_email : string -> string option
val file_exists : string -> bool Lwt.t
val read_file : ?uuid:uuid -> string -> string list option Lwt.t
val write_file : ?uuid:uuid -> string -> string list -> unit Lwt.t
val rmdir : string -> unit Lwt.t
val compile_auth_config : auth_config -> string * (string * string list)
......
......@@ -1555,9 +1555,7 @@ let make_archive uuid =
let fname_new = fname ^ ".new" in
let%lwt () = copy_file (temp_dir / "archive.zip") fname_new in
let%lwt () = Lwt_unix.rename fname_new fname in
let command = "rm", [| "rm"; "-rf"; temp_dir |] in
let%lwt _ = Lwt_process.exec command in
return_unit
rmdir temp_dir
| _ ->
Printf.ksprintf Ocsigen_messages.errlog
"Error while creating archive.zip for election %s, temporary directory left in %s"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment