17840: Check for unparsed command line arguments.
[arvados.git] / services / crunch-dispatch-slurm / crunch-dispatch-slurm.go
index 584db38edf7e93ac57ad8929ca31e04de907b78d..02493bf4fb451450e5c684ebab48af7f4676b46e 100644 (file)
@@ -91,13 +91,14 @@ func (disp *Dispatcher) configure(prog string, args []string) error {
                false,
                "Print version information and exit.")
 
-       args = loader.MungeLegacyConfigArgs(logrus.StandardLogger(), args, "-legacy-crunch-dispatch-slurm-config")
-
-       // Parse args; omit the first arg which is the command name
+       args = loader.MungeLegacyConfigArgs(disp.logger, args, "-legacy-crunch-dispatch-slurm-config")
        err := flags.Parse(args)
-
        if err == flag.ErrHelp {
                return nil
+       } else if err != nil {
+               return err
+       } else if flags.NArg() != 0 {
+               return fmt.Errorf("unrecognized command line arguments: %v", flags.Args())
        }
 
        // Print version information if requested