@cryptotaxi247 / kubo / commits / 53a80e255

parse: fix arg number check

This should fix issue #1196 (Can't launch a command line process from Qt). The check was bad because it took stdin into account, but it really shouldn't. License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>

Christian Couder committed May 17, 2015 at 23:59 UTC 53a80e255f78a0fbf509544900a485eb70fc5234
1 file changed +2 -2
commands/cli/parse.go
+2 -2
@@ -228,8 +228,8 @@ func parseArgs(inputs []string, stdin *os.File, argDefs []cmds.Argument, recursi
228 // if we have more arg values provided than argument definitions,
229 // and the last arg definition is not variadic (or there are no definitions), return an error
230 notVariadic := len(argDefs) == 0 || !argDefs[len(argDefs)-1].Variadic
231 - if notVariadic && numInputs > len(argDefs) {
232 - return nil, nil, fmt.Errorf("Expected %v arguments, got %v: %v", len(argDefs), numInputs, inputs)
231 + if notVariadic && len(inputs) > len(argDefs) {
232 + return nil, nil, fmt.Errorf("Expected %v arguments, got %v: %v", len(argDefs), len(inputs), inputs)
233 }
234
235 stringArgs := make([]string, 0, numInputs)