From 53a80e255f78a0fbf509544900a485eb70fc5234 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Sun, 17 May 2015 23:59:01 +0200 Subject: [PATCH] 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 --- commands/cli/parse.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/cli/parse.go b/commands/cli/parse.go index c512e64bc2c..92be53fa669 100644 --- a/commands/cli/parse.go +++ b/commands/cli/parse.go @@ -228,8 +228,8 @@ func parseArgs(inputs []string, stdin *os.File, argDefs []cmds.Argument, recursi // if we have more arg values provided than argument definitions, // and the last arg definition is not variadic (or there are no definitions), return an error notVariadic := len(argDefs) == 0 || !argDefs[len(argDefs)-1].Variadic - if notVariadic && numInputs > len(argDefs) { - return nil, nil, fmt.Errorf("Expected %v arguments, got %v: %v", len(argDefs), numInputs, inputs) + if notVariadic && len(inputs) > len(argDefs) { + return nil, nil, fmt.Errorf("Expected %v arguments, got %v: %v", len(argDefs), len(inputs), inputs) } stringArgs := make([]string, 0, numInputs)