From 13608df0efb53f9fdbe1d3c98ea27fd222610188 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 5 Aug 2021 01:12:10 -0400 Subject: [PATCH] fix: properly pass in password to docker login command --- plugins/registry/subcommands.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/registry/subcommands.go b/plugins/registry/subcommands.go index c9d424f53..beabc002a 100644 --- a/plugins/registry/subcommands.go +++ b/plugins/registry/subcommands.go @@ -1,8 +1,8 @@ package registry import ( + "bytes" "errors" - "io" "io/ioutil" "os" "strings" @@ -40,10 +40,11 @@ func CommandLogin(server string, username string, password string, passwordStdin server, } - reader, writer := io.Pipe() - writer.Write([]byte(password)) + buffer := bytes.Buffer{} + buffer.Write([]byte(password + "\n")) + loginCmd := common.NewShellCmd(strings.Join(command, " ")) - loginCmd.Command.Stdin = reader + loginCmd.Command.Stdin = &buffer if !loginCmd.Execute() { return errors.New("Failed to log into registry") }