The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

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

Fix cmdliner tool on Windows (#233)

+8 -4
+8 -4
vendor/opam/cmdliner/src/tool/cmdliner_main.ml
··· 6 6 let strf = Printf.sprintf 7 7 let error_to_failure = function Ok v -> v | Error e -> failwith e 8 8 9 + let quote_tool tool = 10 + (* Can be replaced by Filename.quote_command once we drop OCaml < 4.10 *) 11 + Filename.quote @@ 12 + if Sys.win32 then String.map (function '/' -> '\\' | c -> c) tool else tool 13 + 9 14 let find_sub ?(start = 0) ~sub s = 10 15 (* naive algorithm, worst case O(length sub * length s) *) 11 16 let len_sub = String.length sub in ··· 29 34 let err_cmd exit cmd = 30 35 raise (Sys_error (strf "exited with %d: %s\n" exit cmd)) 31 36 in 32 - let quote_cmd = if Sys.win32 then fun cmd -> strf "\"%s\"" cmd else Fun.id in 33 37 let run_cmd args = 34 38 let cmd = String.concat " " (List.map Filename.quote args) in 35 - let exit = Sys.command (quote_cmd cmd) in 39 + let exit = Sys.command cmd in 36 40 if exit = 0 then () else err_cmd exit cmd 37 41 in 38 42 let parent = Filename.dirname dir in ··· 165 169 | [] -> [] 166 170 in 167 171 let exec = 168 - strf "%s --__complete %s --__complete=" (Filename.quote tool) cmd 172 + strf "%s --__complete %s --__complete=" (quote_tool tool) cmd 169 173 in 170 174 let comps = exec_stdout exec |> error_to_failure in 171 175 let comps = String.split_on_char '\n' comps in ··· 186 190 with Failure e -> Error e 187 191 188 192 let get_tool_command_man tool ~name cmd = 189 - let tool = Filename.quote tool in 193 + let tool = quote_tool tool in 190 194 let exec = if cmd = "" then tool else String.concat " " [tool; cmd] in 191 195 let man_basename = 192 196 let exec = if cmd = "" then name else String.concat " " [name; cmd] in