Skip to content

Commit

Permalink
parse: fix arg number check
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
chriscool committed May 17, 2015
1 parent c93d583 commit 53a80e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions commands/cli/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 53a80e2

Please sign in to comment.