github.com/sijibomii/docker@v0.0.0-20231230191044-5cf6ca554647/cliconfig/credentials/shell_command.go (about)

     1  package credentials
     2  
     3  import (
     4  	"io"
     5  	"os/exec"
     6  )
     7  
     8  func shellCommandFn(storeName string) func(args ...string) command {
     9  	name := remoteCredentialsPrefix + storeName
    10  	return func(args ...string) command {
    11  		return &shell{cmd: exec.Command(name, args...)}
    12  	}
    13  }
    14  
    15  // shell invokes shell commands to talk with a remote credentials helper.
    16  type shell struct {
    17  	cmd *exec.Cmd
    18  }
    19  
    20  // Output returns responses from the remote credentials helper.
    21  func (s *shell) Output() ([]byte, error) {
    22  	return s.cmd.Output()
    23  }
    24  
    25  // Input sets the input to send to a remote credentials helper.
    26  func (s *shell) Input(in io.Reader) {
    27  	s.cmd.Stdin = in
    28  }