1
0
mirror of https://github.com/docker/docker-credential-helpers.git synced 2026-06-13 16:01:28 +05:30

Caller of cred helpers would now see the stderr returns from cred helpers

Signed-off-by: shhsu@microsoft.com <shhsu@microsoft.com>
This commit is contained in:
shhsu@microsoft.com
2017-05-24 15:38:36 -07:00
parent 71779cf7f5
commit 18d35e4984
+8 -1
View File
@@ -2,6 +2,7 @@ package client
import ( import (
"io" "io"
"os"
"os/exec" "os/exec"
) )
@@ -17,10 +18,16 @@ type ProgramFunc func(args ...string) Program
// NewShellProgramFunc creates programs that are executed in a Shell. // NewShellProgramFunc creates programs that are executed in a Shell.
func NewShellProgramFunc(name string) ProgramFunc { func NewShellProgramFunc(name string) ProgramFunc {
return func(args ...string) Program { return func(args ...string) Program {
return &Shell{cmd: exec.Command(name, args...)} return &Shell{cmd: newCmdRedirectErr(name, args)}
} }
} }
func newCmdRedirectErr(name string, args []string) *exec.Cmd {
newCmd := exec.Command(name, args...)
newCmd.Stderr = os.Stderr
return newCmd
}
// Shell invokes shell commands to talk with a remote credentials helper. // Shell invokes shell commands to talk with a remote credentials helper.
type Shell struct { type Shell struct {
cmd *exec.Cmd cmd *exec.Cmd