mirror of
https://github.com/docker/docker-credential-helpers.git
synced 2026-06-13 16:01:28 +05:30
Merge pull request #64 from shhsu/redirect_stderr
Caller of cred helpers would now see the stderr returns from cred helpers
This commit is contained in:
+8
-1
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user