Skip to content

Commit

Permalink
Remove unnecessary sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
dra27 committed Aug 20, 2024
1 parent 6a212c3 commit 3ad7a33
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions src/repository/opamDownload.ml
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,21 @@ let tool_return url ret =
| _, `Curl ->
if OpamProcess.is_failure ret then
fail (Some "Curl failed", Printf.sprintf "Curl failed: %s"
(OpamProcess.result_summary ret));
match ret.OpamProcess.r_stdout with
| [] ->
fail (Some "curl empty response",
Printf.sprintf "curl: empty response while downloading %s"
(OpamUrl.to_string url))
| l ->
let code = List.hd (List.rev l) in
let num = try int_of_string code with Failure _ -> 999 in
if num >= 400 then
fail (Some ("curl error code " ^ code),
Printf.sprintf "curl: code %s while downloading %s"
code (OpamUrl.to_string url))
else Done ()
(OpamProcess.result_summary ret))
else
match ret.OpamProcess.r_stdout with
| [] ->
fail (Some "curl empty response",
Printf.sprintf "curl: empty response while downloading %s"
(OpamUrl.to_string url))
| l ->
let code = List.hd (List.rev l) in
let num = try int_of_string code with Failure _ -> 999 in
if num >= 400 then
fail (Some ("curl error code " ^ code),
Printf.sprintf "curl: code %s while downloading %s"
code (OpamUrl.to_string url))
else Done ()

let download_command ~compress ?checksum ~url ~dst () =
let cmd, args =
Expand Down

0 comments on commit 3ad7a33

Please sign in to comment.