Homebrew bottle builder and tap manager for OCaml monorepos
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

bottler: remove space* binaries, use Bos for commands

+11 -6
+11 -6
bin/cmd_update.ml
··· 13 13 if binaries = [] then ( 14 14 Fmt.epr "No matching binaries found.@."; 15 15 exit 1); 16 - (* Update the tap first *) 17 16 let tap_name = Homebrew.tap_name config in 18 - let status = Sys.command (Fmt.str "brew update") in 19 - if status <> 0 then Fmt.epr "Warning: brew update failed (exit %d)@." status; 17 + (* Update the tap *) 18 + (match Bos.OS.Cmd.run Bos.Cmd.(v "brew" % "update") with 19 + | Ok () -> () 20 + | Error _ -> Fmt.epr "Warning: brew update failed@."); 20 21 (* Only upgrade binaries that are already installed *) 21 22 let installed = 22 23 List.filter 23 24 (fun (b : Homebrew.binary) -> 24 25 let formula = Fmt.str "%s/%s" tap_name b.name in 25 - Sys.command (Fmt.str "brew list %s >/dev/null 2>&1" formula) = 0) 26 + match Bos.OS.Cmd.run_status Bos.Cmd.(v "brew" % "list" % formula) with 27 + | Ok (`Exited 0) -> true 28 + | _ -> false) 26 29 binaries 27 30 in 28 31 if installed = [] then ( ··· 32 35 (fun (b : Homebrew.binary) -> 33 36 let formula = Fmt.str "%s/%s" tap_name b.name in 34 37 Fmt.pr "Upgrading %s...@." b.name; 35 - ignore (Sys.command (Fmt.str "brew upgrade %s" formula))) 38 + match Bos.OS.Cmd.run Bos.Cmd.(v "brew" % "upgrade" % formula) with 39 + | Ok () -> () 40 + | Error _ -> Fmt.epr " Failed to upgrade %s@." b.name) 36 41 installed; 37 42 Fmt.pr "Done. %d binaries upgraded.@." (List.length installed) 38 43 39 44 let cmd = 40 - let doc = "Upgrade all bottled binaries via brew." in 45 + let doc = "Upgrade installed bottled binaries via brew." in 41 46 let info = Cmd.info "update" ~doc in 42 47 Cmd.v info Term.(const run $ Common.config_file $ Common.binary_names)