gen_licenses: simplify the removal of the trailing CR with String.trim
This commit is contained in:
1 parent
8645471410
commit
47d59988c2
1 file changed
+1
-5
@@ -21,13 +21,9 @@ let rec map_result f = function
|
|||||||
Ok (y :: ys)
|
Ok (y :: ys)
|
||||||
|
|
||||||
let ocamlfind args = Cmd.(v "ocamlfind" %% of_list args)
|
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 lines cmd =
|
||||||
let* l = OS.Cmd.(run_out cmd |> to_lines) in
|
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 line cmd =
|
||||||
let* l = lines cmd in
|
let* l = lines cmd in
|
||||||
|
|||||||
Reference in new issue
Block a user