diff --git a/src/ocamlorg_package/lib/opam_repository.ml b/src/ocamlorg_package/lib/opam_repository.ml index 6464f31c15..e63cb4d102 100644 --- a/src/ocamlorg_package/lib/opam_repository.ml +++ b/src/ocamlorg_package/lib/opam_repository.ml @@ -20,7 +20,9 @@ module Process = struct let exec cmd = let proc = Lwt_process.open_process_none cmd in - proc#status >|= check_status cmd + let open Lwt.Syntax in + let+ status = proc#status in + match status with Unix.WEXITED 0 -> Ok () | s -> Error (cmd, s) let pread cmd = let proc = Lwt_process.open_process_in cmd in @@ -51,7 +53,7 @@ let last_commit () = let clone () = let open Lwt.Syntax in - let* () = + let* res = Process.exec ( "git", [| @@ -61,13 +63,24 @@ let clone () = Fpath.to_string clone_path; |] ) in + (match res with Ok () -> () | Error (c, s) -> Process.check_status c s); last_commit () let pull () = let open Lwt.Syntax in - let* () = + let* pul = Process.exec (git_cmd [ "pull"; "-q"; "--ff-only"; "origin"; "master" ]) in + (match pul with + | Ok () -> () + | Error (_, Unix.WEXITED 1) -> + prerr_endline + "\n\ + Pulling from opam repository was not possible. \n\ + We will continue by building the package state\n\ + using the existing local state of opam-repository.\n\ + Some functionality might not work properly.\n" + | Error (c, s) -> Process.check_status c s); last_commit () let fold_dir f acc directory =