Sfoglia il codice sorgente

Read the stdin line properly.

Load the auth config before it's used.
David Calavera 12 anni fa
parent
commit
ce53e21ea6
1 ha cambiato i file con 3 aggiunte e 2 eliminazioni
  1. 3 2
      commands.go

+ 3 - 2
commands.go

@@ -277,14 +277,15 @@ func (cli *DockerCli) CmdLogin(args ...string) error {
 
 	readInput := func(in io.Reader, out io.Writer) string {
 		reader := bufio.NewReader(in)
-		line, err := reader.ReadString('\n')
+		line, _, err := reader.ReadLine()
 		if err != nil {
 			fmt.Fprintln(out, err.Error())
 			os.Exit(1)
 		}
-		return line
+		return string(line)
 	}
 
+	cli.LoadConfigFile()
 	authconfig, ok := cli.configFile.Configs[auth.IndexServerAddress()]
 	if !ok {
 		authconfig = auth.AuthConfig{}