gen_licenses: simplify the removal of the trailing CR with String.trim

This commit is contained in:
Matthieu Dubuget committed 2026-11-22 19:21:42 +01:00
1 parent 8645471410
commit 47d59988c2
1 file changed
+1 -5
+1 -5
View File
@@ -21,13 +21,9 @@ let rec map_result f = function
Ok (y :: ys)
let ocamlfind args = Cmd.(v "ocamlfind" %% of_list args)
let chop_cr s =
let n = String.length s in
if n > 0 && s.[n - 1] = '\r' then String.sub s 0 (n - 1) else s
let lines cmd =
let* l = OS.Cmd.(run_out cmd |> to_lines) in
Ok (List.map chop_cr l)
Ok (List.map String.trim l)
let line cmd =
let* l = lines cmd in