let src = Logs.Src.create "day11.exec.sudo" ~doc:"Privileged execution" module Log = (val Logs.src_log src) let run ?output_file env cmd = let sudo_cmd = Bos.Cmd.(v "sudo" %% cmd) in try Ok (Run.run env sudo_cmd output_file) with exn -> Rresult.R.error_msgf "sudo: %s" (Printexc.to_string exn) let rm_rf env path = let cmd = Bos.Cmd.(v "rm" % "-rf" % Fpath.to_string path) in run env cmd |> Result.map (fun _run -> ())