From 18d35e4984102dbf6bcbdcd124325d0f364f6ee8 Mon Sep 17 00:00:00 2001 From: "shhsu@microsoft.com" Date: Wed, 24 May 2017 15:38:36 -0700 Subject: [PATCH] Caller of cred helpers would now see the stderr returns from cred helpers Signed-off-by: shhsu@microsoft.com --- client/command.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/command.go b/client/command.go index 8983da6..a144d5a 100644 --- a/client/command.go +++ b/client/command.go @@ -2,6 +2,7 @@ package client import ( "io" + "os" "os/exec" ) @@ -17,10 +18,16 @@ type ProgramFunc func(args ...string) Program // NewShellProgramFunc creates programs that are executed in a Shell. func NewShellProgramFunc(name string) ProgramFunc { 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. type Shell struct { cmd *exec.Cmd