Commit 53a80e25 authored by Christian Couder's avatar Christian Couder

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: default avatarChristian Couder <chriscool@tuxfamily.org>
parent c93d583f
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment