From e79f3837c3ed06cc32cb28d3d8d3bbac7a8add84 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Sat, 8 Jul 2017 06:46:04 -0700 Subject: [PATCH] [CLOpt] allow to override the subcommand in infer sub-processes Summary: Error'ing when getting several subcommands on the command line only makes sense when the user typed these options herself. This was causing a bug in the Gradle integration, and possibly others (see GitHub issue). Fixes #668 Reviewed By: jeremydubreil Differential Revision: D5381850 fbshipit-source-id: f332377 --- infer/src/base/CommandLineOption.ml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/infer/src/base/CommandLineOption.ml b/infer/src/base/CommandLineOption.ml index 138a4a3d7..13db076a4 100644 --- a/infer/src/base/CommandLineOption.ml +++ b/infer/src/base/CommandLineOption.ml @@ -658,10 +658,10 @@ let anon_fun arg = else if !anon_arg_action.parse_subcommands && List.Assoc.mem !subcommand_actions ~equal:String.equal arg then let command_switch = List.Assoc.find_exn !subcommand_actions ~equal:String.equal arg in - match !curr_command with - | None -> + match !curr_command, is_originator with + | None, _ | Some _, false -> command_switch () - | Some command -> + | Some command, true -> raise (Arg.Bad (Printf.sprintf "More than one subcommand specified: '%s', '%s'" (string_of_command command) arg))