Print usage message when cl arg parsing fails

Summary:public
D2987288 introduced a regression where usage messages were no longer printed, and instead exceptions went uncaught.

Reviewed By: jeremydubreil

Differential Revision: D3089620

fb-gh-sync-id: 1cca0c6
shipit-source-id: 1cca0c6
master
Josh Berdine 9 years ago committed by Facebook Github Bot 8
parent ebe82340b9
commit 63b1df9966

@ -868,7 +868,11 @@ module Arg = struct
let parse env_var spec anon usage =
let env_args = env_to_argv (try Unix.getenv env_var with Not_found -> "") in
let env_cl_args = prepend_to_argv env_args in
Arg.parse_argv (Array.of_list env_cl_args) spec anon usage
try
Arg.parse_argv (Array.of_list env_cl_args) spec anon usage
with
| Bad usage -> Pervasives.prerr_string usage; exit 2;
| Help usage -> Pervasives.print_string usage; exit 0;
end

Loading…
Cancel
Save