diff --git a/ocaml/xapi-idl/lib/xcp_service.ml b/ocaml/xapi-idl/lib/xcp_service.ml index a768309132..01c65bc49f 100644 --- a/ocaml/xapi-idl/lib/xcp_service.ml +++ b/ocaml/xapi-idl/lib/xcp_service.ml @@ -464,7 +464,13 @@ let configure ?(argv = Sys.argv) ?(options = []) ?(resources = []) () = (fun _ -> failwith "Invalid argument") (Printf.sprintf "Usage: %s [-config filename]" Sys.argv.(0)) ) - with Failure msg -> prerr_endline msg ; flush stderr ; exit 1 + with + | Failure msg -> + prerr_endline msg ; flush stderr ; exit 1 + | Arg.Bad msg -> + Printf.eprintf "%s" msg ; exit 2 + | Arg.Help msg -> + Printf.printf "%s" msg ; exit 0 let configure2 ~name ~version ~doc ?(options = []) ?(resources = []) () = configure_common ~options ~resources @@ fun config_spec ->