Browse Source

Merge pull request #10402 from markmc/interactive-watch-panic

etcdctl: fix interactive mode panic
Xiang Li 7 years ago
parent
commit
a00bff7848
1 changed files with 4 additions and 0 deletions
  1. 4 0
      etcdctl/ctlv3/command/watch_command.go

+ 4 - 0
etcdctl/ctlv3/command/watch_command.go

@@ -101,6 +101,10 @@ func watchInteractiveFunc(cmd *cobra.Command, osArgs []string, envKey, envRange
 		l = strings.TrimSuffix(l, "\n")
 		l = strings.TrimSuffix(l, "\n")
 
 
 		args := argify(l)
 		args := argify(l)
+		if len(args) < 1 {
+			fmt.Fprintf(os.Stderr, "Invalid command: %s (watch and progress supported)\n", l)
+			continue
+		}
 		switch args[0] {
 		switch args[0] {
 		case "watch":
 		case "watch":
 			if len(args) < 2 && envKey == "" {
 			if len(args) < 2 && envKey == "" {